You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What if broker_loop() will send client messages back to connection_loop() instead of creating connection_writer_loop() and passing Acr<TcpStram> all around? This can IMO lead to cleaner design, what is always good in tutorial. Also Acr<TcpStram> is not necessary then, because TcpStream never escapes connection_loop(). We can also use let (socket_reader, mut socket_writer) = (&stream, &stream); pattern here.
Documentation
Async chat server example is using
connection_writer_loop()
task to ensure, that client messages will not be interleaved. https://book.async.rs/tutorial/sending_messagesWhat if
broker_loop()
will send client messages back toconnection_loop()
instead of creatingconnection_writer_loop()
and passingAcr<TcpStram>
all around? This can IMO lead to cleaner design, what is always good in tutorial. AlsoAcr<TcpStram>
is not necessary then, because TcpStream never escapesconnection_loop()
. We can also uselet (socket_reader, mut socket_writer) = (&stream, &stream);
pattern here.We can then write something like this:
The text was updated successfully, but these errors were encountered: