Close socket after the handle_request function not inside handle_request
authorMason Larobina <mason.larobina@gmail.com>
Mon, 27 Jul 2009 16:17:12 +0000 (00:17 +0800)
committerMason Larobina <mason.larobina@gmail.com>
Mon, 27 Jul 2009 16:17:12 +0000 (00:17 +0800)
examples/data/uzbl/scripts/cookie_daemon.py

index 6866ae2..21a03d6 100755 (executable)
@@ -257,6 +257,7 @@ class CookieMonster:
                 client_socket, _ = self.server_socket.accept()
                 self.handle_request(client_socket)
                 self.last_request = time.time()
+                client_socket.close()
             
             if self.daemon_timeout:
                 idle = time.time() - self.last_request
@@ -316,8 +317,6 @@ class CookieMonster:
 
         if print_cookie: print
             
-        client_socket.close()
-
 
     def quit(self, *args):
         '''Called on exit to make sure all loose ends are tied up.'''