diff options
| author | P. Christeas <p_christ@hol.gr> | 2011-01-18 14:59:03 +0200 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2011-01-18 14:59:03 +0200 |
| commit | 06b0cdbfaa7f016ebf5cf5aa8e069e038b013f09 (patch) | |
| tree | 85ee14113092e1b1708d59fdb7473c2b374f319a | |
| parent | 1be56517a3ad0d9e3fef4af28b80569c78082e1d (diff) | |
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
| -rw-r--r-- | bin/tiny_socket.py | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/bin/tiny_socket.py b/bin/tiny_socket.py index 6a0d9371ef5..44f7db04f01 100644 --- a/bin/tiny_socket.py +++ b/bin/tiny_socket.py @@ -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='' |
