Commit 20ce4405 authored by Jeremy Hylton's avatar Jeremy Hylton

int -> bool

parent 441eb553
...@@ -70,7 +70,7 @@ class SizedMessageAsyncConnection(asyncore.dispatcher): ...@@ -70,7 +70,7 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
__super_init = asyncore.dispatcher.__init__ __super_init = asyncore.dispatcher.__init__
__super_close = asyncore.dispatcher.close __super_close = asyncore.dispatcher.close
__closed = 1 # Marker indicating that we're closed __closed = True # Marker indicating that we're closed
socket = None # to outwit Sam's getattr socket = None # to outwit Sam's getattr
...@@ -99,7 +99,7 @@ class SizedMessageAsyncConnection(asyncore.dispatcher): ...@@ -99,7 +99,7 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
self.__msg_size = 4 self.__msg_size = 4
self.__output_lock = threading.Lock() # Protects __output self.__output_lock = threading.Lock() # Protects __output
self.__output = [] self.__output = []
self.__closed = 0 self.__closed = False
# Each side of the connection sends and receives messages. A # Each side of the connection sends and receives messages. A
# MAC is generated for each message and depends on each # MAC is generated for each message and depends on each
# previous MAC; the state of the MAC generator depends on the # previous MAC; the state of the MAC generator depends on the
...@@ -225,13 +225,13 @@ class SizedMessageAsyncConnection(asyncore.dispatcher): ...@@ -225,13 +225,13 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
self.__input_lock.release() self.__input_lock.release()
def readable(self): def readable(self):
return 1 return True
def writable(self): def writable(self):
if len(self.__output) == 0: if len(self.__output) == 0:
return 0 return False
else: else:
return 1 return True
def handle_write(self): def handle_write(self):
self.__output_lock.acquire() self.__output_lock.acquire()
...@@ -302,5 +302,5 @@ class SizedMessageAsyncConnection(asyncore.dispatcher): ...@@ -302,5 +302,5 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
def close(self): def close(self):
if not self.__closed: if not self.__closed:
self.__closed = 1 self.__closed = True
self.__super_close() self.__super_close()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment