Shareaza switches to random port mode on connection loss
Posted: 08 Apr 2013 17:59
I originally posted this in the Help and Support section, but I do feel it should be here, so please forgive me administrators for re-posting, and feel free to delete it from there.
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.
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)
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.
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)