go-telnet
go-telnet copied to clipboard
Wait for connect to finish sending all data
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.
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.
My vote for this pull request