1. Ionata Digital
  2. Untitled project
  3. pysimplesoap

Commits

Mariano Reingart  committed 7dc8a4b

disabled TCP_NODELAY by default (it breaks httplib2 socks and should be implemented as a transport facility option)

  • Participants
  • Parent commits 8e16427
  • Branches master

Comments (0)

Files changed (1)

File pysimplesoap/transport.py

View file
 
 #
 # Socket wrapper to enable socket.TCP_NODELAY - this greatly speeds up transactions in Linux
-#
-import socket
-realsocket = socket.socket
-def socketwrap(family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0):
-    sockobj = realsocket(family, type, proto)
-    sockobj.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
-    return sockobj
-socket.socket = socketwrap
+# WARNING: this will modify the standard library socket module, use with care!
+# TODO: implement this as a transport faciliy
+#       (to pass options directly to httplib2 or pycurl)
+#       be aware of metaclasses and socks.py (SocksiPy) used by httplib2
+
+if False:
+    import socket
+    realsocket = socket.socket
+    def socketwrap(family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0):
+        sockobj = realsocket(family, type, proto)
+        if type == socket.SOCK_STREAM:
+            sockobj.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
+        return sockobj
+    socket.socket = socketwrap
 
 #
 # We store metadata about what available transport mechanisms we have available.