shutdown the reading and writing side of the

socket and close it, when we disconnect
This commit is contained in:
Dimitur Kirov 2006-02-12 02:21:18 +00:00
parent 81873919c5
commit 7576bb4f3e
1 changed files with 6 additions and 0 deletions

View File

@ -155,6 +155,12 @@ class NonBlockingTcp(PlugIn, IdleObject):
self.remove_timeout()
self._owner.disconnected()
self.idlequeue.unplug_idle(self.fd)
try:
self._sock.shutdown(socket.SHUT_RDWR)
self._sock.close()
except:
# socket is already closed
pass
# socket descriptor cannot be (un)plugged anymore
self.fd = -1
if self.on_disconnect: