mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use SOMAXCONN insteaad of 5 for listen()
This commit is contained in:
parent
0cba5968c2
commit
5c918cc84a
@ -170,7 +170,7 @@ class ServerLoop(object):
|
|||||||
|
|
||||||
self.ready = True
|
self.ready = True
|
||||||
self.connection_map = {}
|
self.connection_map = {}
|
||||||
self.socket.listen(5)
|
self.socket.listen(min(socket.SOMAXCONN, 128))
|
||||||
self.bound_address = ba = self.socket.getsockname()
|
self.bound_address = ba = self.socket.getsockname()
|
||||||
if isinstance(ba, tuple):
|
if isinstance(ba, tuple):
|
||||||
ba = ':'.join(map(type(''), ba))
|
ba = ':'.join(map(type(''), ba))
|
||||||
@ -296,7 +296,7 @@ class ServerLoop(object):
|
|||||||
for s, conn in tuple(self.connection_map.iteritems()):
|
for s, conn in tuple(self.connection_map.iteritems()):
|
||||||
self.close(s, conn)
|
self.close(s, conn)
|
||||||
|
|
||||||
class EchoLine(Connection):
|
class EchoLine(Connection): # {{{
|
||||||
|
|
||||||
bye_after_echo = False
|
bye_after_echo = False
|
||||||
|
|
||||||
@ -329,6 +329,7 @@ class EchoLine(Connection):
|
|||||||
self.ready = False
|
self.ready = False
|
||||||
else:
|
else:
|
||||||
self.rbuf.seek(pos + sent)
|
self.rbuf.seek(pos + sent)
|
||||||
|
# }}}
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
s = ServerLoop(EchoLine)
|
s = ServerLoop(EchoLine)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user