]> granicus.if.org Git - python/commitdiff
reverting r88395 and r88387 as per http://mail.python.org/pipermail/python-dev/2011...
authorGiampaolo Rodolà <g.rodola@gmail.com>
Fri, 11 Feb 2011 14:01:46 +0000 (14:01 +0000)
committerGiampaolo Rodolà <g.rodola@gmail.com>
Fri, 11 Feb 2011 14:01:46 +0000 (14:01 +0000)
Lib/asyncore.py

index 91c629bd0f339e056bf8e0c0565b46b19398128e..a277bddc86a2e3180a51ee3fd2481cf51618104b 100644 (file)
@@ -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()