Closed tatref closed 3 years ago
Hi @tatref,
The only reason to make it so is to not duplicate lines 22-24 in the code example. There are no blocking issues. It's totally safe to send the message just in the Connected
event if the established flag is true.
EDIT: no blocking issues beyond the TCP blocking issues if the receiver buffer is full.
I close this issue. If you need more information feel free to reopen or open a new issue :)
Hi,
In the client, a
Signal
is sent when the connection is established https://github.com/lemunozm/message-io/blob/656f486fd55bb456bb0e5720f6ffa1d518d54106/examples/ping-pong/client.rs#L22-L25Then the real message is sent later: https://github.com/lemunozm/message-io/blob/656f486fd55bb456bb0e5720f6ffa1d518d54106/examples/ping-pong/client.rs#L46-L50
Is there any reason for not sending the message directly in the
NetEvent::Connect
event? Maybe to prevent blocking the thread while sending the message?