From 3313381bef8154bc14e70a5c2c371a2fa53faae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 16 May 2011 12:21:11 +0200 Subject: [PATCH] Use sendall for non-ssl socket --- trytond/pysocket.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/trytond/pysocket.py b/trytond/pysocket.py index ffbb07dd01..0f160cab35 100644 --- a/trytond/pysocket.py +++ b/trytond/pysocket.py @@ -143,15 +143,15 @@ class PySocket: + (gzip_p and "1" or "0") + msg size = len(msg) - totalsent = 0 - while totalsent < size: - if self.ssl: + if self.ssl: + totalsent = 0 + while totalsent < size: sent = self.ssl_sock.write(msg[totalsent:]) - else: - sent = self.sock.send(msg[totalsent:]) - if sent == 0: - raise RuntimeError, "socket connection broken" - totalsent = totalsent + sent + if sent == 0: + raise RuntimeError, "socket connection broken" + totalsent = totalsent + sent + else: + self.sock.sendall(msg) def receive(self): buf = self.buffer