go-telnet icon indicating copy to clipboard operation
go-telnet copied to clipboard

Wait for connect to finish sending all data

Open thayama opened this issue 5 years ago • 2 comments

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 avatar Dec 06 '18 04:12 thayama

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.

thayama avatar Dec 06 '18 04:12 thayama

My vote for this pull request

mligor avatar Jan 05 '21 08:01 mligor