[tor-bugs] #9716 [Tor]: Don't hardcode listen() backlog

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Sep 10 21:20:47 UTC 2013


#9716: Don't hardcode listen() backlog
-------------------------+-------------------------------------------------
     Reporter:  philip   |      Owner:
         Type:           |     Status:  new
  enhancement            |  Milestone:  Tor: 0.2.5.x-final
     Priority:  normal   |    Version:  Tor: 0.2.4.16-rc
    Component:  Tor      |   Keywords:  tor-relay easy 024-backport limits,
   Resolution:           |  socket, freebsd, linux
Actual Points:           |  Parent ID:
       Points:           |
-------------------------+-------------------------------------------------
Changes (by nickm):

 * keywords:  limits, socket, freebsd, linux => tor-relay easy 024-backport
     limits, socket, freebsd, linux
 * component:  - Select a component => Tor
 * milestone:   => Tor: 0.2.5.x-final


Comment:

 Is that behavior of -1 according to specification?  I don't see it
 documented on the manpage for listen(2) on Linux or OSX, and the
 [http://msdn.microsoft.com/en-
 us/library/windows/desktop/ms739168(v=vs.85).aspx Windows documentation]
 says "Illegal values are replaced by the nearest legal value", which might
 imply that -1 turns into 0 or 1 or something.

 Both manpages document that values larger than the limit are rounded down
 to the true maximum, implying that on those platforms INT_MAX is the
 doucmented way to do this.

 Perhaps we want to do something as simple as:
 {{{
   if (listen(fd, INT_MAX) < 0) {
     // that didn't work; fall back to the stupid thing.
     if (listen (fd, SOMAXCONN) < 0) {
        // neither one worked.
     }
   }
 }}}

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9716#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list