python: shutdown socket at the end of the event loop

This commit is contained in:
Tatsuhiro Tsujikawa 2012-08-28 21:39:24 +09:00
parent 5b521e608b
commit 6cc62c5f22
1 changed files with 7 additions and 0 deletions

View File

@ -1578,6 +1578,13 @@ try:
def loop(self):
self.connect(self.server_address)
try:
self._loop()
finally:
self.sock.shutdown(socket.SHUT_RDWR)
self.sock.close()
def _loop(self):
self.tls_handshake()
self.sock.setblocking(False)