diff options
author | Giampaolo RodolĂ <g.rodola@gmail.com> | 2011-02-11 14:01:46 (GMT) |
---|---|---|
committer | Giampaolo RodolĂ <g.rodola@gmail.com> | 2011-02-11 14:01:46 (GMT) |
commit | 900d5470470d342694e5e9b5cd133f0b0784b292 (patch) | |
tree | 49b68c51285ed38823afbca14b023e2103fc9bbe | |
parent | 42e0b7f47ef3bd1fe3b20ae253c9f660092d2fa4 (diff) | |
download | cpython-900d5470470d342694e5e9b5cd133f0b0784b292.zip cpython-900d5470470d342694e5e9b5cd133f0b0784b292.tar.gz cpython-900d5470470d342694e5e9b5cd133f0b0784b292.tar.bz2 |
reverting r88395 and r88387 as per http://mail.python.org/pipermail/python-dev/2011-February/108005.html
-rw-r--r-- | Lib/asyncore.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 91c629b..a277bdd 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -218,9 +218,10 @@ def loop(timeout=30.0, use_poll=False, map=None, count=None): class dispatcher: + debug = False connected = False accepting = False - closed = False + closing = False addr = None ignore_log_types = frozenset(['warning']) @@ -393,16 +394,14 @@ class dispatcher: raise def close(self): - if not self.closed: - self.closed = True - self.connected = False - self.accepting = False - self.del_channel() - try: - self.socket.close() - except socket.error as why: - if why.args[0] not in (ENOTCONN, EBADF): - raise + self.connected = False + self.accepting = False + self.del_channel() + try: + self.socket.close() + except socket.error as why: + if why.args[0] not in (ENOTCONN, EBADF): + raise # cheap inheritance, used to pass all other attribute # references to the underlying socket object. @@ -545,6 +544,8 @@ class dispatcher_with_send(dispatcher): return (not self.connected) or len(self.out_buffer) def send(self, data): + if self.debug: + self.log_info('sending %s' % repr(data)) self.out_buffer = self.out_buffer + data self.initiate_send() |