Skip to content

Commit

Permalink
my_asynchat: improve closing
Browse files Browse the repository at this point in the history
  • Loading branch information
mknx committed Aug 18, 2013
1 parent bc5e6eb commit 318f546
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/my_asynchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,15 @@ def handle_close(self):
if self.is_connected:
logger.info('{0}: connection to {1}:{2} closed'.format(self.__class__.__name__, self.addr[0], self.addr[1]))
self.connected = False
self.accepting = False
self.is_connected = False
self.del_channel(map=self._sh.socket_map)
self.discard_buffers()
try:
self.close()
self.socket.shutdown(socket.SHUT_RDWR)
except:
pass
try:
self.socket.close()
except:
pass

0 comments on commit 318f546

Please sign in to comment.