[PATCH] close sockets on httprepository deletion (issue1487)

Steve Borho steve at borho.org
Thu Jan 29 02:40:29 UTC 2009


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1233194819 21600
# Node ID c116eb0b7a3808f56bc0f97dd10ea175247de6fb
# Parent  dd970a311ea863376414d77b3b680e206f75e96e
close sockets on httprepository deletion (issue1487)

With this destructor in place, I no longer see tracebacks
on the server after using win32 clients for pull, push, etc.

diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py
--- a/mercurial/httprepo.py
+++ b/mercurial/httprepo.py
@@ -39,6 +39,12 @@
 
         self.urlopener = url.opener(ui, authinfo)
 
+    def __del__(self):
+        for h in self.urlopener.handlers:
+            h.close()
+            if hasattr(h, "close_all"):
+                h.close_all()
+
     def url(self):
         return self.path
 



More information about the Mercurial-devel mailing list