Commits

Giampaolo Rodola committed 4d2a589
  • Participants
  • Parent commits 12acaf7

Comments (0)

Files changed (1)

 
 class dispatcher:
 
+    debug = False
     connected = False
     accepting = False
-    closed = False
+    closing = False
     addr = None
     ignore_log_types = frozenset(['warning'])
 
                 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.
         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()