[Python-checkins] r88396 - python/branches/py3k/Lib/asyncore.py

giampaolo.rodola python-checkins at python.org
Fri Feb 11 15:01:46 CET 2011


Author: giampaolo.rodola
Date: Fri Feb 11 15:01:46 2011
New Revision: 88396

Log:
reverting r88395 and r88387 as per http://mail.python.org/pipermail/python-dev/2011-February/108005.html

Modified:
   python/branches/py3k/Lib/asyncore.py

Modified: python/branches/py3k/Lib/asyncore.py
==============================================================================
--- python/branches/py3k/Lib/asyncore.py	(original)
+++ python/branches/py3k/Lib/asyncore.py	Fri Feb 11 15:01:46 2011
@@ -218,9 +218,10 @@
 
 class dispatcher:
 
+    debug = False
     connected = False
     accepting = False
-    closed = False
+    closing = False
     addr = None
     ignore_log_types = frozenset(['warning'])
 
@@ -393,16 +394,14 @@
                 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 @@
         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()
 


More information about the Python-checkins mailing list