#2122: lt1.6: Now supports port re-use via two simple flags
-------------------------------------------+--------------------------------
 Reporter:  bmnot                          |       Owner:                       
 
     Type:  bug                            |      Status:  new                  
 
 Priority:  minor                          |   Milestone:  1.4.0                
 
Component:  other                          |     Version:  other (please 
specify)
 Keywords:  single port bind socket reuse  |  
-------------------------------------------+--------------------------------
 Currently, setting up Deluge to use a single port is very unreliable (that
 is, disabling random incoming port, and setting a port range of something
 like "52100 to 52100").

 The issue is that re-starting the daemon will most often lead to the
 desired port being in use and a new random one chosen by the system.

 The reason is that when a program frees up a port on Linux, it doesn't get
 immediately freed. It goes into a TIME_WAIT state, where it is available
 for fast re-binding in case an application changes its mind and wants it
 again. It's not fully killed off until a few seconds later.

 To re-bind on the same port, Deluge will have to use libtorrent 1.6, which
 finally supports the TCP socket options to re-use the same port even if
 it's in the TIME_WAIT state, as well as a new option that refuses to bind
 if the desired port is in use (rather than choosing a random port).

 It's described at http://code.google.com/p/libtorrent/issues/detail?id=305
 but basically works as follows:

 When migrated to lt 0.16, always use the session::listen_reuse_address
 flag to ensure it is allowed to re-use a TIME_WAIT port. if random_port ==
 false && from_port == to_port, use the session::listen_no_system_port flag
 too to ensure that the system cannot change the desired port from what you
 wanted. If we could not bind the single port we wanted, kill the daemon
 and log a fatal error saying "port in use".

-- 
Ticket URL: <http://dev.deluge-torrent.org/ticket/2122>
Deluge <http://deluge-torrent.org/>
Deluge project

-- 
You received this message because you are subscribed to the Google Groups 
"Deluge Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-dev?hl=en.

Reply via email to