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

Infinite loop if the connection is lost #27

Open
mame opened this issue Sep 20, 2023 · 1 comment
Open

Infinite loop if the connection is lost #27

mame opened this issue Sep 20, 2023 · 1 comment

Comments

@mame
Copy link

mame commented Sep 20, 2023

while !@closed do
begin
unless recv_data = @socket.getc
sleep 1
next
end

When the TCPSocket is closed from the server side, getc always returns nil, so this code is an infinite loop. I am not sure what the intent of this code is, but it is definitely a bug and I am reporting it anyway.

Note that reading one letter at a time by using getc is not a good idea in terms of efficiency.

@unasuke
Copy link
Collaborator

unasuke commented Sep 20, 2023

Thank you for report.

Note that reading one letter at a time by using getc is not a good idea in terms of efficiency.

We knew that. Reported at #11 .

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 a pull request may close this issue.

2 participants