close sockets on httprepository deletion (issue1487)
authorSteve Borho <steve@borho.org>
Wed, 28 Jan 2009 20:06:59 -0600
changeset 7752 998fc8f62539
parent 7751 9294c0158c42
child 7753 e617f2e99e61
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.
mercurial/httprepo.py
--- a/mercurial/httprepo.py	Tue Feb 10 13:57:34 2009 +0800
+++ b/mercurial/httprepo.py	Wed Jan 28 20:06:59 2009 -0600
@@ -38,6 +38,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