[committed] Upnp support and some optimizations

A place to submit .patch fixes for the DOL SVN

Moderator: Developer Team

[committed] Upnp support and some optimizations

Postby Dre » Wed Sep 29, 2010 6:14 am

Hello,

I added UPnP IGD support (see the patch below).
I do a small optimization in InventoryItem.Dirty (setter).

I optimized the KeepMgr.LoadHookPoints() method but I have a problem when I profile it. I have 11go of data instead of less than 1go for this method after optimization (I don't know why :|) so this patch isn't included in UPnP patch.

PS: All patch were created in "DOLSharp/trunk/" but with GameServerScripts this time :)
Attachments
keep_optimization.patch
(3.27 KiB) Downloaded 18 times
add_upnp.patch
(13.43 KiB) Downloaded 17 times
Dre
Developer
 
Posts: 206
Joined: Fri Oct 29, 2004 6:24 pm
Website: https://amtenael.fr

Re: Upnp support and some optimizations

Postby Graveen » Wed Sep 29, 2010 8:18 am

Thank you Dre, nice patchs.

I suppose the lambda you use in the keepmgr introduces the overhead. I'll review this before integration.

/wav ;)
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: Upnp support and some optimizations

Postby Dre » Wed Sep 29, 2010 11:10 am

I did more search and I find this blog's article: http://my-tech-talk.blogspot.com/2009/0 ... er-is.html
So I think that it's a bug of VS 2008 profiler... I'll test with another profiler when I can :)
Dre
Developer
 
Posts: 206
Joined: Fri Oct 29, 2004 6:24 pm
Website: https://amtenael.fr

Re: Upnp support and some optimizations

Postby Graveen » Wed Sep 29, 2010 11:53 am

sharpdevelop 4 's built-in one.
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: [committed] Upnp support and some optimizations

Postby Graveen » Wed Sep 29, 2010 12:06 pm

Accepted, thank you, soon in SVN !
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: [committed] Upnp support and some optimizations

Postby Graveen » Wed Sep 29, 2010 5:56 pm

I can't have the uPNP working

Basically, Dawn of Light should

1) check if uPNP universal host service is running
2) find an uPNP device
3) add rules tcp 10300 udp 10400 to the gateway

We agree bout this ?
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: [committed] Upnp support and some optimizations

Postby Dre » Thu Sep 30, 2010 9:53 am

Graveen wrote:I can't have the uPNP working

Basically, Dawn of Light should

1) check if uPNP universal host service is running
2) find an uPNP device
3) add rules tcp 10300 udp 10400 to the gateway

We agree bout this ?


Not really, the "UPnP universal host service" can be activated on a computer sharing its connection, it will turn it into UPnP IGD (see: http://support.microsoft.com/kb/323713) but I didn't tested it and you don't need it on host of dol. I will test it on Windows 7 and vmware :)

For having UPnP, you need an UPnP IGD in your LAN (in France, many box have this features). This UPnP implementation broadcast a discorey packet (see "UPnPNat.Discover()") and wait for a response of a UPnP IGD.

There are a small problem, UPnP is based on SSDP and it's an expired draft so maybe some device aren't recognized (see: http://en.wikipedia.org/wiki/Simple_Ser ... y_Protocol).
Admin of Amtenael
Dre
Developer
 
Posts: 206
Joined: Fri Oct 29, 2004 6:24 pm
Website: https://amtenael.fr

Re: [committed] Upnp support and some optimizations

Postby Dinberg » Thu Sep 30, 2010 9:56 am

Graveen wrote:I can't have the uPNP working

Basically, Dawn of Light should

1) check if uPNP universal host service is running
2) find an uPNP device
3) add rules tcp 10300 udp 10400 to the gateway

We agree bout this ?


No, because those are magic numbers :D

I think you mean to check the config file for its udp/tcp port setup and add those entries, for those of us who dont want to use 10300/10400 for dawn of light ^^
The Marvelous Contraption begins to stir...
User avatar
Dinberg
Inactive Staff Member
 
Posts: 4695
Joined: Sat Mar 10, 2007 9:47 am
Yahoo Messenger: dinberg_darktouch
Location: Jordheim

Re: [committed] Upnp support and some optimizations

Postby Dre » Thu Sep 30, 2010 11:36 am

Dre wrote:Not really, the "UPnP universal host service" can be activated on a computer sharing its connection, it will turn it into UPnP IGD (see: http://support.microsoft.com/kb/323713) but I didn't tested it and you don't need it on host of dol. I will test it on Windows 7 and vmware :)


I tested with Windows 7, it was not working completely, there is the bugfix. :)
So actually, UPnP has been tested with Freebox (French ISP's box) and Windows IGD if you have another devices to test... (I don't have another UPnP IGD)
Attachments
bugfix_upnp.patch
(4.33 KiB) Downloaded 19 times
Admin of Amtenael
Dre
Developer
 
Posts: 206
Joined: Fri Oct 29, 2004 6:24 pm
Website: https://amtenael.fr

Re: [committed] Upnp support and some optimizations

Postby Graveen » Thu Sep 30, 2010 12:01 pm

Dinny, i mean the process to connect, the ports are effectively embedded.


Dre, i was targetting upnp nat translation, via upnp igd. As this is an interesting topic i never throw an eye, i gave a look at former uPnP protocols, associated structures and the current code.

There are 2 problems:
- the fact it is locked on the s.receive()
- the fact it is not working


Basically, TimeSpan trick for timeout is not working. I worked with the Harold Aptroot's code ( http://www.codeproject.com/KB/IP/upnpnattraversal.aspx ) - the UPnPNat class you pushed in DOL - and i was not able to have it working on my lan. In fact, after some deep test, the fwk 2.0 socket.Receive() is *not* blocking, while fwk 3.5 one is... Here is the first problem.
Second, my router is not found by Harold's code. it is a perfect UPNP IGD device anyway, but i assume this code is deprecated or too much linked in fwk 2.0.

Basically, i expect rougly what i describe:
- detect any upnp igd device
- open dol ports
- close them after server is not running

DoL must map automagically the ports, similar to what uTorrent is performing, else this is breaking the need for it, and the ease it brings. TBH i troubleshooted Harold's code and get it working with fwk 3.5, so i should fix it soon, perhaps this evening.
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: [committed] Upnp support and some optimizations

Postby Graveen » Thu Sep 30, 2010 12:03 pm

Ah bah excellent, this evening i'll test it :D
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France


Return to “%s” DOL Code Contributions

Who is online

Users browsing this forum: No registered users and 1 guest