Skip to content

Commit

Permalink
transport_service: Improve logs and move code from tokio::select macro (
Browse files Browse the repository at this point in the history
#254)

Tiny PR to enhance the transport service logs with protocol and
endpoints.

While at it, have refactored the code to move away from the tokio select
and use dedicated fns.

---------

Signed-off-by: Alexandru Vasile <[email protected]>
  • Loading branch information
lexnv authored Oct 1, 2024
1 parent 4201cad commit b967de3
Show file tree
Hide file tree
Showing 2 changed files with 236 additions and 160 deletions.
5 changes: 4 additions & 1 deletion src/protocol/transport_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,10 @@ impl Stream for TransportService {
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
while let Poll::Ready(event) = self.rx.poll_recv(cx) {
match event {
None => return Poll::Ready(None),
None => {
tracing::warn!(target: LOG_TARGET, "transport service closed");
return Poll::Ready(None);
}
Some(InnerTransportEvent::ConnectionEstablished {
peer,
endpoint,
Expand Down
Loading

0 comments on commit b967de3

Please sign in to comment.