net-rpc: Send all data in one TCP packet

This optimises the TCP layer significantly, avoids ACK delays.

Inspired by: Julien Thewys

bzr revid: p_christ@hol.gr-20110118125903-5hrg89kpi1vuadv9
This commit is contained in:
P. Christeas
2011-01-18 14:59:03 +02:00
parent 1be56517a3
commit 06b0cdbfaa
+1 -9
View File
@@ -61,15 +61,7 @@ class mysocket:
def mysend(self, msg, exception=False, traceback=None):
msg = cPickle.dumps([msg,traceback])
size = len(msg)
self.sock.send('%8d' % size)
self.sock.send(exception and "1" or "0")
totalsent = 0
while totalsent < size:
sent = self.sock.send(msg[totalsent:])
if sent == 0:
raise RuntimeError, "socket connection broken"
totalsent = totalsent + sent
self.sock.sendall('%8d%s%s' % (len(msg), exception and "1" or "0", msg))
def myreceive(self):
buf=''