@@ -82,7 +82,7 @@ def readline(self):
8282 """Attempt to return as many bytes as we can up to but not including '\r \n '"""
8383 while b'\r \n ' not in self ._buffer :
8484 # there's no line already in there, read some more
85- avail = min (_the_interface .socket_available (self ._socknum ), 4000 )
85+ avail = min (_the_interface .socket_available (self ._socknum ), 1500 )
8686 if avail :
8787 self ._buffer += _the_interface .socket_read (self ._socknum , avail )
8888 firstline , self ._buffer = self ._buffer .split (b'\r \n ' , 1 )
@@ -92,15 +92,18 @@ def read(self, size=0):
9292 """Read up to 'size' bytes from the socket, this may be buffered internally!
9393 If 'size' isnt specified, return everything in the buffer."""
9494 if size == 0 : # read as much as we can at the moment
95- avail = min (_the_interface .socket_available (self ._socknum ), 4000 )
96- if avail :
97- self ._buffer += _the_interface .socket_read (self ._socknum , avail )
95+ while True :
96+ avail = min (_the_interface .socket_available (self ._socknum ), 1500 )
97+ if avail :
98+ self ._buffer += _the_interface .socket_read (self ._socknum , avail )
99+ else :
100+ break
98101 ret = self ._buffer
99102 self ._buffer = b''
100103 return ret
101104 stamp = time .monotonic ()
102105 while len (self ._buffer ) < size :
103- avail = min (_the_interface .socket_available (self ._socknum ), 4000 )
106+ avail = min (_the_interface .socket_available (self ._socknum ), 1500 )
104107 if avail :
105108 stamp = time .monotonic ()
106109 self ._buffer += _the_interface .socket_read (self ._socknum , min (size , avail ))
0 commit comments