def _recvall_blocking(conn, amount):
data = []
while amount > 0:
with wrapped_socket_errnos(errno.ECONNRESET):
piece = conn.recv(amount)
if not piece:
raise _ConnectionLost("could not recv() all bytes")
data.append(piece)
amount -= len(piece)
return "".join(data)
评论列表
文章目录