diff options
| author | Florent Xicluna <florent.xicluna@gmail.com> | 2012-01-23 15:29:32 +0100 |
|---|---|---|
| committer | Florent Xicluna <florent.xicluna@gmail.com> | 2012-01-23 15:29:32 +0100 |
| commit | c749cd8fcc864e6103f55bcf7b12e0910f2ffa14 (patch) | |
| tree | 60a330d66092a2a5eec8995e990bf66b5cf15d09 /openerp/tiny_socket.py | |
| parent | a6042ec08c5e691440e5e99560bafa150a1f36b8 (diff) | |
[IMP] upgrade the Pickle protocol to consume less bandwidth.
bzr revid: florent.xicluna@gmail.com-20120123142932-idcqz4p46gvbvhfh
Diffstat (limited to 'openerp/tiny_socket.py')
| -rw-r--r-- | openerp/tiny_socket.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/openerp/tiny_socket.py b/openerp/tiny_socket.py index b4bed83a4c0..c3960afd054 100644 --- a/openerp/tiny_socket.py +++ b/openerp/tiny_socket.py @@ -28,6 +28,10 @@ import netsvc #.apidoc title: Net-RPC classes +# Pickle protocol version 2 is optimized compared to default (version 0) +PICKLE_PROTOCOL = 2 + + class Myexception(Exception): """ custom exception object store @@ -63,8 +67,8 @@ class mysocket: netsvc.close_socket(self.sock) def mysend(self, msg, exception=False, traceback=None): - msg = cPickle.dumps([msg,traceback]) - self.sock.sendall('%8d%s%s' % (len(msg), exception and "1" or "0", msg)) + msg = cPickle.dumps([msg, traceback], PICKLE_PROTOCOL) + self.sock.sendall('%8d%d%s' % (len(msg), bool(exception), msg)) def myreceive(self): buf='' |
