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

Wait for connect to finish sending all data #11

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

Conversation

thayama
Copy link

@thayama thayama commented Dec 6, 2018

Goroutines created in connect, transfer data from a handler to telnet
client. However, as there's no synchronization between the goroutine
and the telnet server, there's a case where the server sends a prompt
before the goroutines finished all transmissions.

This fix assure that the telnet server waits until all data are sent to
the client, before sending a prompt.

@thayama
Copy link
Author

thayama commented Dec 6, 2018

I've found an issue that the one last byte generated by telsh.Handler is sent after the shell prompt.
Currently, there is a race condition between handler.Run() and go func launched in connect().

I've added channels to wait for go funcs launched in connect() to finish their jobs.

Goroutines created in connect, transfer data from a handler to telnet
client. However, as there's no synchronization between the goroutines
and the telnet server, there's a case where the server sends a prompt
before the goroutines finishsed all transmissions.

This fix assure that the telnet server waits until all data are sent to
the client, before sending a prompt.
@mligor
Copy link

mligor commented Jan 5, 2021

My vote for this pull request

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.

None yet

2 participants