asyncio_micro: awrite(): More logging and checks.

pull/11/head
Paul Sokolovsky 2014-07-24 18:47:16 +03:00
rodzic abd8b1646a
commit 545a033933
1 zmienionych plików z 2 dodań i 0 usunięć

Wyświetl plik

@ -224,6 +224,7 @@ class StreamWriter:
# to return immediately (which means it has to buffer all the # to return immediately (which means it has to buffer all the
# data), this method is a coroutine. # data), this method is a coroutine.
sz = len(buf) sz = len(buf)
log.debug("StreamWriter.awrite(): spooling %d bytes", sz)
while True: while True:
res = self.s.write(buf) res = self.s.write(buf)
# If we spooled everything, return immediately # If we spooled everything, return immediately
@ -233,6 +234,7 @@ class StreamWriter:
if res is None: if res is None:
res = 0 res = 0
log.debug("StreamWriter.awrite(): spooled partial %d bytes", res) log.debug("StreamWriter.awrite(): spooled partial %d bytes", res)
assert res < sz
buf = buf[res:] buf = buf[res:]
sz -= res sz -= res
s = yield IOWrite(self.s) s = yield IOWrite(self.s)