[MERGED] python/osmo-python-tests[master]: osmotestconfig: fix socket leak

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Feb 24 19:52:14 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: osmotestconfig: fix socket leak
......................................................................


osmotestconfig: fix socket leak

Each running test would open up another socket without ever closing unused
ones. Close the sockets after each test is done.

Change-Id: If97944a079e901439139161eae39181f5c800200
---
M osmopy/osmotestconfig.py
1 file changed, 3 insertions(+), 0 deletions(-)

Approvals:
  Neels Hofmeyr: Verified
  Harald Welte: Looks good to me, approved



diff --git a/osmopy/osmotestconfig.py b/osmopy/osmotestconfig.py
index 8e5f253..0d2b2d9 100644
--- a/osmopy/osmotestconfig.py
+++ b/osmopy/osmotestconfig.py
@@ -48,6 +48,7 @@
 def test_config_atest(app_desc, config, run_test, verbose=True):
     proc = None
     ret = None
+    vty = None
     try:
         cmd = app_desc[1].split(' ') + [ "-c", config]
         if verbose:
@@ -69,6 +70,8 @@
     finally:
         if proc:
             osmoutil.end_proc(proc)
+        if vty:
+           vty._close_socket()
 
     return ret
 

-- 
To view, visit https://gerrit.osmocom.org/1903
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If97944a079e901439139161eae39181f5c800200
Gerrit-PatchSet: 4
Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list