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