From bac1a957193c5b76fc944d268d2b711809e34d19 Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Mon, 23 Jan 2012 15:30:15 +0100 Subject: [PATCH] =?UTF-8?q?[IMP]=C2=A0merge=20two=20socket.recv=20into=20o?= =?UTF-8?q?ne.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bzr revid: florent.xicluna@gmail.com-20120123143015-gz22l5qre6ria8f4 --- openerp/tiny_socket.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/openerp/tiny_socket.py b/openerp/tiny_socket.py index c3960afd054..87db82f6d91 100644 --- a/openerp/tiny_socket.py +++ b/openerp/tiny_socket.py @@ -72,15 +72,14 @@ class mysocket: def myreceive(self): buf='' - while len(buf) < 8: - chunk = self.sock.recv(8 - len(buf)) + while len(buf) < 9: + chunk = self.sock.recv(9 - len(buf)) if not chunk: raise socket.timeout buf += chunk - size = int(buf) - buf = self.sock.recv(1) - if buf != "0": - exception = buf + size = int(buf[:8]) + if buf[8] != "0": + exception = buf[8] else: exception = False msg = ''