From 57d76a1e76d77b23ed3e616dae761bc8e6b7021c Mon Sep 17 00:00:00 2001 From: Vikraman Choudhury Date: Tue, 17 Apr 2012 19:36:13 +0530 Subject: close HTTPConnection in finally block --- client/gentoostats-send | 3 +++ client/gentoostats/utils.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/client/gentoostats-send b/client/gentoostats-send index 324b2bc..2ae2857 100755 --- a/client/gentoostats-send +++ b/client/gentoostats-send @@ -72,6 +72,9 @@ def main(): except httplib.HTTPException: sys.stderr.write('Something went wrong') sys.exit(1) + finally: + if conn: + conn.close() if __name__ == "__main__": main() diff --git a/client/gentoostats/utils.py b/client/gentoostats/utils.py index 43a3c73..af807c8 100644 --- a/client/gentoostats/utils.py +++ b/client/gentoostats/utils.py @@ -18,6 +18,9 @@ def GET(server, url, headers, https=True): data = conn.getresponse().read() except httplib.HTTPException: return None + finally: + if conn: + conn.close() return data def deserialize(object): -- cgit v1.2.3-65-gdbad