From 6cc62c5f225fe4160a244ea6b35fc45160fb11b7 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 28 Aug 2012 21:39:24 +0900 Subject: [PATCH] python: shutdown socket at the end of the event loop --- python/spdylay.pyx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/spdylay.pyx b/python/spdylay.pyx index b80f49dd..97b66b5b 100644 --- a/python/spdylay.pyx +++ b/python/spdylay.pyx @@ -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)