From 545a03393360436c8aa38ab7d3703569e2297ca0 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 24 Jul 2014 18:47:16 +0300 Subject: [PATCH] asyncio_micro: awrite(): More logging and checks. --- asyncio_micro/asyncio_micro.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/asyncio_micro/asyncio_micro.py b/asyncio_micro/asyncio_micro.py index 48a27dd0..cd7a00ec 100644 --- a/asyncio_micro/asyncio_micro.py +++ b/asyncio_micro/asyncio_micro.py @@ -224,6 +224,7 @@ class StreamWriter: # to return immediately (which means it has to buffer all the # data), this method is a coroutine. sz = len(buf) + log.debug("StreamWriter.awrite(): spooling %d bytes", sz) while True: res = self.s.write(buf) # If we spooled everything, return immediately @@ -233,6 +234,7 @@ class StreamWriter: if res is None: res = 0 log.debug("StreamWriter.awrite(): spooled partial %d bytes", res) + assert res < sz buf = buf[res:] sz -= res s = yield IOWrite(self.s)