@@ -82,7 +82,7 @@ def readline(self):
82
82
"""Attempt to return as many bytes as we can up to but not including '\r \n '"""
83
83
while b'\r \n ' not in self ._buffer :
84
84
# 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 )
86
86
if avail :
87
87
self ._buffer += _the_interface .socket_read (self ._socknum , avail )
88
88
firstline , self ._buffer = self ._buffer .split (b'\r \n ' , 1 )
@@ -92,15 +92,18 @@ def read(self, size=0):
92
92
"""Read up to 'size' bytes from the socket, this may be buffered internally!
93
93
If 'size' isnt specified, return everything in the buffer."""
94
94
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
98
101
ret = self ._buffer
99
102
self ._buffer = b''
100
103
return ret
101
104
stamp = time .monotonic ()
102
105
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 )
104
107
if avail :
105
108
stamp = time .monotonic ()
106
109
self ._buffer += _the_interface .socket_read (self ._socknum , min (size , avail ))
0 commit comments