[MERGE] netrpc: disable TCP "Nagle" algorithm to minimize RPC delays, especially on windows

bzr revid: odo@openerp.com-20110118155946-9h207h8np16bplqh
This commit is contained in:
Julien Thewys 2011-01-18 16:59:46 +01:00 committed by Olivier Dony
commit 0a71cd2982
1 changed files with 2 additions and 0 deletions

View File

@ -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.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
self.socket.bind((self.__interface, self.__port))
self.socket.listen(5)
self.threads = []