]> granicus.if.org Git - python/commitdiff
http://bugs.python.org/issue6192
authorKristján Valur Jónsson <kristjan@ccpgames.com>
Sun, 28 Jun 2009 21:34:22 +0000 (21:34 +0000)
committerKristján Valur Jónsson <kristjan@ccpgames.com>
Sun, 28 Jun 2009 21:34:22 +0000 (21:34 +0000)
Mergin revisions 73272 and 73546 to py3k

Lib/socketserver.py

index 92adbcfaf584c0196cd7d2eeafd7a73489001cab..2ed50b9842e6ca39e5909966784c59c4e5ef7430 100644 (file)
@@ -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)