Shareaza switches to random port mode on connection loss

Post comments about Shareaza code and discuss with other developers.
Forum rules
Home | Wiki | Rules

Shareaza switches to random port mode on connection loss

Postby pluriel » 07 Apr 2013 19:12

My internet connection drops out briefly from time to time. I've noticed that Shareaza automatically enters random UPnP port mode after about a minute when this happens and registers new (random) ports with the router (random gets checked in Internet->Connection settings page). Also, Shareaza deletes the newly registered random ports from the router's port map list when closing the connection, but the previously registered ports remain (which means I have to remove them manually).

I would like Shareaza to continue using the originally registered ports and not enable random ports when the internet connection is lost. I have tried changing Connection.DetectConnectionLoss and Connection.DetectConnectionReset, and combinations thereof in the Advanced settings page to no avail.

Can anyone help me fix this odd behavior?
Last edited by pluriel on 08 Apr 2013 18:06, edited 2 times in total.
pluriel
 
Posts: 16
Joined: 07 Apr 2013 18:56

Re: Shareaza switches to random port mode on connection loss

Postby pluriel » 08 Apr 2013 11:00

On closer inspection it appears that after the internet connection is lost (but before it's re-established), Shareaza sends a "port open" request to the router using the same port number it had requested the first time. These ports being already assigned, the router presumably sends a "port not available" reply (or something to that effect) to Shareaza, to which Shareaza responds by entering random port mode and re-requesting ports using the new random port number. Shareaza "forgets about" the original ports thereafter, having replaced them with the new random ports.

Since Shareaza cannot know the reason why the internet connection was lost; e.g. whether or not the router was turned off, or there was a line dropout, ppp disconnect, etc., and hence cannot tell whether or not the prevously assigned ports are still active (i.e. on the router's UPnP port map list), there should be a fix to this which covers all cases. I suppose a solution would be for Shareaza to:

a) Wait until the internet connection is re-established,
b) Close the previously requested ports (i.e. send a "port close" command), and
c) Send a new "port open" command using the original port number

after the internet connection is lost, without entering random port mode. An alternative might be to change b) to:

b) Check if the previously assigned ports are still active (i.e. send a "port list" command), and skip c) if they are.

Any thoughts about this are appreciated.

PS I'm talking here about the current 32-bit release of Shareaza (v. 2.6.0.0)
Last edited by pluriel on 19 Apr 2013 14:12, edited 1 time in total.
pluriel
 
Posts: 16
Joined: 07 Apr 2013 18:56

Re: Shareaza switches to random port mode on connection loss

Postby old_death » 19 Apr 2013 11:46

I've moved this to the development discussion...
User avatar
old_death
 
Posts: 1950
Joined: 13 Jun 2009 16:19

Re: Shareaza switches to random port mode on connection loss

Postby pluriel » 19 Apr 2013 15:04

As an additional thought, if Shareaza were to check the UPnP port status (or just close/open ports) whenever it begins its connection sequence, this would also prevent it from re-requesting ports after a PC/program crash.

:geek:
pluriel
 
Posts: 16
Joined: 07 Apr 2013 18:56

Re: Shareaza switches to random port mode on connection loss

Postby queuesclimber » 22 May 2015 20:42

Like you know, I am a trunkrunner on low level. VS2013 Update 3
Running @release, SSE2, debug (.pdb) and my settings hardcoded.
And it happens since around 8 month.
This is a Bug.

This is what I have found out.
When having a standrad-crash ( like in albumfolder.cpp in bugreportwindow ) everything is fine.
But when getting [Access Violation at (memory:adress) in shareaza.exe ] and memory is shuffled to somewhat,
sometimes it happends the RandomPortBug.

Mmmhhh, InPort is stored in registry. For crosschecking ( in the debugs ) cant you store a .cfg-7z somewhere ?
LOL, it's dinosaur-technology. (But when restarting and getting lowID, always port has changed)
User avatar
queuesclimber
 
Posts: 249
Joined: 29 Oct 2013 16:24

Re: Shareaza switches to random port mode on connection loss

Postby siavoshkc » 27 Feb 2016 14:50

I conform that Shareaza enables random port by itself when starting network core while UPnP function is enabled. I don't know if it happens when UPnP is disabled or not.
siavoshkc
 
Posts: 347
Joined: 02 Nov 2009 09:37


Return to Development Discussion

Who is online

Users browsing this forum: No registered users and 1 guest