[PATCH] python/osmo-python-tests[master]: tcp_debug: don't abort when socket can't be removed

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
Mon Feb 27 01:13:32 UTC 2017


Review at  https://gerrit.osmocom.org/1921

tcp_debug: don't abort when socket can't be removed

It appears that during some error conditions, the socket will not be in the tcp
socket debug tracking list, and on top of an exception this barfs as well.
Let's not care about the tcp debug list and avoid confusing error messages.

Change-Id: I8daa317fed8fc7e720dccb70fd5f7fc74fde423f
---
M osmopy/obscvty.py
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/21/1921/1

diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py
index 420db7d..cb2d06f 100755
--- a/osmopy/obscvty.py
+++ b/osmopy/obscvty.py
@@ -74,7 +74,10 @@
             return
 
         if debug_tcp_sockets:
-            VTYInteract.all_sockets.remove(self.socket)
+            try:
+                VTYInteract.all_sockets.remove(self.socket)
+            except ValueError:
+                pass
             print "Socket: closing %s:%d %r (%d sockets open)" % (
                     self.host, self.port, self.socket,
                     len(VTYInteract.all_sockets))

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8daa317fed8fc7e720dccb70fd5f7fc74fde423f
Gerrit-PatchSet: 1
Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list