Attempting UPNP for DC++

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Locked
mgillespie
Posts: 21
Joined: 2004-08-08 09:12

Attempting UPNP for DC++

Post by mgillespie » 2004-08-10 14:55

I did email the DC++ author, but did not hear back..

I am looking at implementing UPnP capability for DC++ I was just checking nobody is already working on it before I start.. (well actually, I am already about 40% done)...

I also have 1 small question...

Does DC++ protocol only use 1 port (SearchManager::getInstance()->setPort(); )?

TheParanoidOne
Forum Moderator
Posts: 1420
Joined: 2003-04-22 14:37

Post by TheParanoidOne » 2004-08-10 17:05

As far as I am aware, nobody is working on UPnP support. If you intend to submit a patch, make sure you read compile.txt.

As for ports, yes. DC++ uses only one, with both TCP and UDP.
The world is coming to an end. Please log off.

DC++ Guide | Words

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-08-10 18:53

Excellent. My linux router supports UPnP, I intended to look into it. Now, I don't have to bother. :)

mgillespie
Posts: 21
Joined: 2004-08-08 09:12

Post by mgillespie » 2004-08-11 12:04

Once I get something I believe works (as far as UPnP goes), are there any problems with me building a binary, sticking it on my webspace, and getting a few bods to test it before submitting it as a patch?

I don't want to tread on toes, or upset people...

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-08-11 12:19

mgillespie wrote:I don't want to tread on toes, or upset people...
If you're distributing programs derived from the DC++ source, you just need to obey the GPL.

In particular, make sure you have 95/98/ME testers, as well as 2k and XP ones.

The code will likely need to make use of the existing OS detection code to avoid running the UPnP code (and loading the required DLL[s]) on platforms that don't support it, like anything older than XP.

mgillespie
Posts: 21
Joined: 2004-08-08 09:12

Post by mgillespie » 2004-08-11 15:46

I believe it's only XP and newer that support UPnP anyway, so was planning on disabling the option on everything else.. I was going to leave the option in the advanced settings page, label it as (Windows XP or later required) and then do a OS check just prior to enabling the UPnP ports.

The code I have so far is pretty self contained, most of the UPnP stuff being in a single UPnP class (in a seperate UPNP.cpp), with only a few lines of code in the existing code and the addition of the preference to use it (defaulting to disabled). Am thinking from a patch acceptance point of view..

I'm hoping to have something working this week, depending upon time and other stuff I got on..

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-08-11 23:08

If there's not much code, it wouldn't hurt to add it to Util.h/cpp - having it in a separate file doesn't gain much when there's already so much IP manipulation stuff in the aforementioned utility classes.

mgillespie
Posts: 21
Joined: 2004-08-08 09:12

Post by mgillespie » 2004-08-13 16:47

Have got a test build with UPnP support..

http://www.mgillespie.plus.com/DCPlusPlus-UPNP.zip

Make sure you read the PDF file in the zip

any questions/comments/bitches etc, use the email at the botton of the PDF...

Xan1977
Forum Moderator
Posts: 627
Joined: 2003-06-05 20:15

Post by Xan1977 » 2004-08-13 18:46

I tested it on my XP box, but without any luck. The log file indicates that it failed to create port mappings and then failed to remove port mappings. The first time I enabled the advanced option DC++ crashed on exit generating the exception dialog. But since there is no .PDB included with that distribution, no exceptioninfo.txt was created.

Your binary did not crash ever again even after repeated opening and closing. However, each open and close wrote an error mapping ports to system.log

I tried it on my other XP box which has SP2 installed, but with the same results. The new firewall displays services differently, but it's still the same concept.

That brings me to the testing instructions. Isn't the pupose of using UPnP to automatically configure an external routing device (one which supports UPnP, anyway)? I do have a router which supports UPnP and it is enabled in settings, but I've never used any software which takes advantage of it. So, would you mind outlining exactly what this patch is meant to do? Sorry, I'm a bit lost.

mgillespie
Posts: 21
Joined: 2004-08-08 09:12

Post by mgillespie » 2004-08-14 03:59

The testing instructions are purely that, confirmation that things are doing what they should, under nomal useage, you would not do them,,,

Do you have the UPnP settings dialog as shown in the PDF? By the sounds of it, you may have UPnP disabled on your router. or switched of in XP. I may need to tweak it to check for UPnP before attempting to create the connections...

The patch automatically creates UPNP port mappings, and removes them when the application closes.

As for the crash, I think I have found that problem. Basically, it was trying to remove ports that has not been created. the 1st time the option i switched on and the application was closed. Did it crash on closing??

I have updated the zipfile with a new binary that fixes this (obvious) mistake...

mgillespie
Posts: 21
Joined: 2004-08-08 09:12

Post by mgillespie » 2004-08-14 04:53

In the updated ZIP, also checkout the new PDF instructions, I have added a few troubleshooting tips for setting up WindowsXP for UPnP (which I think is the problem here...)

mgillespie
Posts: 21
Joined: 2004-08-08 09:12

Post by mgillespie » 2004-08-21 11:23

Patch submitted to the DC++ team. Lets see if it's accepted. :-)

The test binary on my homepage has been to inlcude the changes fixed in 0.4032 release.

mgillespie
Posts: 21
Joined: 2004-08-08 09:12

Post by mgillespie » 2004-08-22 08:24

Have added the wish and patch to Bugzilla.

http://dcplusplus.sourceforge.net/cgi-b ... cgi?id=127

Locked