From: Kristján Valur Jónsson Date: Sun, 28 Jun 2009 21:34:22 +0000 (+0000) Subject: http://bugs.python.org/issue6192 X-Git-Tag: v3.2a1~2955 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41a5750656da116a9e8f5f49e02f37d743d04a9e;p=python http://bugs.python.org/issue6192 Mergin revisions 73272 and 73546 to py3k --- diff --git a/Lib/socketserver.py b/Lib/socketserver.py index 92adbcfaf5..2ed50b9842 100644 --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -646,8 +646,15 @@ class StreamRequestHandler(BaseRequestHandler): rbufsize = -1 wbufsize = 0 + # Disable nagle algoritm for this socket, if True. + # Use only when wbufsize != 0, to avoid small packets. + disable_nagle_algorithm = False + def setup(self): self.connection = self.request + if self.disable_nagle_algorithm: + self.connection.setsockopt(socket.IPPROTO_TCP, + socket.TCP_NODELAY, True) self.rfile = self.connection.makefile('rb', self.rbufsize) self.wfile = self.connection.makefile('wb', self.wbufsize)