[MERGED] 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 Mar 6 14:31:52 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: tcp_debug: don't abort when socket can't be removed
......................................................................


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(-)

Approvals:
  Holger Freyther: Looks good to me, approved



diff --git a/osmopy/obscvty.py b/osmopy/obscvty.py
index bbf6e45..f5c85fb 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: merged
Gerrit-Change-Id: I8daa317fed8fc7e720dccb70fd5f7fc74fde423f
Gerrit-PatchSet: 2
Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list