servers: call recv late

This commit is contained in:
nemunaire 2017-09-25 23:56:28 +02:00 committed by Pierre-Olivier Mercier
parent 62cd92e1cb
commit 28d4e507eb
2 changed files with 3 additions and 7 deletions

View File

@ -130,7 +130,7 @@ class AbstractServer:
A list of fully received messages
"""
ret, self._readbuffer = self.lex(self._readbuffer + self._fd.read())
ret, self._readbuffer = self.lex(self._readbuffer + self.read())
for r in ret:
yield r

View File

@ -51,8 +51,8 @@ class _Socket(AbstractServer):
# Read
def recv(self, *args, **kwargs):
return self._fd.recv(*args, **kwargs)
def read(self, bufsize=1024, *args, **kwargs):
return self._fd.recv(bufsize, *args, **kwargs)
def parse(self, line):
@ -115,10 +115,6 @@ class SocketClient(_Socket):
super().__init__(fdClass=socket.socket, **kwargs)
def read(self):
return self._fd.recv()
class _Listener:
def __init__(self, new_server_cb, instanciate=SocketClient, **kwargs):