[FIX] socket: avoids interaction between Nagle and delayed ACK algorithm.
By default, ACK delay is 200ms on Windows which terribly slows down conversations between client and server (when deployed on different machines). To avoid any slow down, TCP_NODELAY should be enabled on clients' socket too. More details: http://developers.slashdot.org/comments.pl?sid=174457&threshold=1&commentsort=0&mode=thread&cid=14515105 bzr revid: jth@openerp.com-20110117205959-8kxaz0of8ta9dmfw
This commit is contained in:
@@ -108,6 +108,8 @@ class TinySocketServerThread(threading.Thread,netsvc.Server):
|
||||
self.__interface = interface
|
||||
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
# disables Nagle algorithm (avoids 200ms default delay on Windows)
|
||||
self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||
self.socket.bind((self.__interface, self.__port))
|
||||
self.socket.listen(5)
|
||||
self.threads = []
|
||||
|
||||
Reference in New Issue
Block a user