[IMP] merge two socket.recv into one.
bzr revid: florent.xicluna@gmail.com-20120123143015-gz22l5qre6ria8f4
This commit is contained in:
parent
c749cd8fcc
commit
bac1a95719
|
@ -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 = ''
|
||||
|
|
Loading…
Reference in New Issue