pyvisa / pyvisa-py

A pure python PyVISA backend
https://pyvisa-py.readthedocs.io
MIT License
282 stars 120 forks source link

Add missing sock.close() to rpc _connect() #388

Closed ACharlyR closed 1 year ago

ACharlyR commented 1 year ago

The socket was not closed if the _connect() function timed out. This lead to an unclosed socket every time a second instance of pyvisa attempted to connect to a device while the first instance of pyvisa still had an open connection.

With this fix, the second instance can back off and try again at a later time without reaching an irrecoverable state.

codecov-commenter commented 1 year ago

Codecov Report

Merging #388 (1d767e0) into main (c33f4f2) will decrease coverage by 0.01%. The diff coverage is 0.00%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #388      +/-   ##
==========================================
- Coverage   23.05%   23.04%   -0.01%     
==========================================
  Files          22       22              
  Lines        3292     3293       +1     
  Branches      456      456              
==========================================
  Hits          759      759              
  Misses       2516     2516              
- Partials       17       18       +1     
Flag Coverage Δ
unittests 23.04% <0.00%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
pyvisa_py/protocols/rpc.py 21.99% <0.00%> (-0.04%) :arrow_down: