[issue12498] asyncore.dispatcher_with_send, disconnection problem + miss-conception

Xavier de Gaye report at bugs.python.org
Thu Nov 3 21:12:39 CET 2011


Xavier de Gaye <xdegaye at gmail.com> added the comment:

Follow my comments about half_duplex_close.diff (current latest patch).

+    def handle_close(self):
+        if not self._closing:
+            self._closing = True
+            # try to drain the output buffer
+            while self.writable() and self.initiate_send() > 0:
+                pass
+        self.close()

> *Any* while loop should be avoided in the dispatcher. 
> The risk is you keep the poller busy for more than a single loop or,
> at worst, forever.

Right. I will try to change that.


> Also, you expect initiate_send() to return a meaningful value which
> breaks compatibility with existing asynchat code overriding it.

The patch changes also initiate_send() accordingly in asynchat.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12498>
_______________________________________


More information about the Python-bugs-list mailing list