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