Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix read infinite loop in closed socket connection #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ivangonzalezacuna
Copy link

During some testings using socketscpi and a Keysight device, I found a bug causing the class to start an infinite loop. The process is:

  1. Connect to the SCPI socket of the Keysight device using the connect() function and keep that connection open
  2. Then, disconnect the device, so the socket is closed by the server
  3. Try to read data using the same socketscpi connection

The while statement is being executed as a loop, because no '\n' is going to be received (the connection is closed). Now it checks if the chunk is empty and raises an Exception in that case, avoiding the infinite loop to happen again when the connection is closed by the server.

Probably the binblockwrite() has a similar problem, but I couldn't check it as I'm not using that function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant