File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -105,8 +105,10 @@ def readline(self):
105
105
return firstline
106
106
107
107
def recv (self , bufsize = 0 ):
108
- """Reads some bytes from the connected remote address.
109
- :param int bufsize: maximum number of bytes to receive
108
+ """Reads some bytes from the connected remote address. Will only return
109
+ an empty string after the configured timeout.
110
+
111
+ :param int bufsize: maximum number of bytes to receive
110
112
"""
111
113
# print("Socket read", bufsize)
112
114
if bufsize == 0 : # read as much as we can at the moment
@@ -134,6 +136,10 @@ def recv(self, bufsize=0):
134
136
received .append (recv )
135
137
to_read -= len (recv )
136
138
gc .collect ()
139
+ elif received :
140
+ # We've received some bytes but no more are available. So return
141
+ # what we have.
142
+ break
137
143
if self ._timeout > 0 and time .monotonic () - stamp > self ._timeout :
138
144
break
139
145
# print(received)
You can’t perform that action at this time.
0 commit comments