<p><a href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/21504">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/21504/3/src/osmo_gsm_tester/obj/osmo_vty.py">File src/osmo_gsm_tester/obj/osmo_vty.py:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/21504/3/src/osmo_gsm_tester/obj/osmo_vty.py@64">Patch Set #3, Line 64:</a> <code style="font-family:monospace,monospace">            self.sck = None</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">is socket closed whenever you set it to None? I'd prefer having an explicitly sck.close() here.</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">the None is just an indicator that the socket is currently not open.</p><p style="white-space: pre-wrap; word-wrap: break-word;">socket cleanup should be explicit. i guessed sck.close() needs to happen only after sck.connect() was successful, and otherwise the socket would be implicitly closed from the ConnectionRefusedError.</p><p style="white-space: pre-wrap; word-wrap: break-word;">from python3 docs:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> Sockets are automatically closed when they are garbage-collected, but it is recommended to close() them explicitly, or to use a with statement around them.</pre><p style="white-space: pre-wrap; word-wrap: break-word;">interesting:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">  socket.close()<br>    Mark the socket closed. The underlying system resource (e.g. a file descriptor) is also closed when all file objects from makefile() are closed.</pre><p style="white-space: pre-wrap; word-wrap: break-word;">and</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> Note<br> close() releases the resource associated with a connection but does not necessarily close the connection immediately. If you want to close the connection in a timely fashion, call shutdown() before close(). </pre><p style="white-space: pre-wrap; word-wrap: break-word;">i should anyway probably 'except' on anything, not just ConnectionRefusedError.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/21504">change 21504</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/21504"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-gsm-tester </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I7c17b143b7c690b8c4105ee7c6272670046fa91d </div>
<div style="display:none"> Gerrit-Change-Number: 21504 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 07 Dec 2020 21:45:23 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>