Skip to content

Commit

Permalink
add debug logging and format tcp server actor
Browse files Browse the repository at this point in the history
  • Loading branch information
mycognosist committed May 15, 2023
1 parent 456f563 commit 5d35c02
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/actors/tcp_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use async_std::{
};
use futures::{select_biased, FutureExt};
use kuska_ssb::keystore::OwnedIdentity;
use log::debug;

use crate::{broker::*, Result};

Expand All @@ -18,14 +19,22 @@ pub async fn actor(

let listener = TcpListener::bind(addr).await?;
let mut incoming = listener.incoming();
debug!("Listening for inbound TCP connection...");

loop {
select_biased! {
_ = ch_terminate => break,
stream = incoming.next().fuse() => {
if let Some(stream) = stream {
if let Ok(stream) = stream {
Broker::spawn(super::peer::actor(server_id.clone(), super::peer::Connect::ClientStream{stream}, selective_replication));
debug!("Received inbound TCP connection");
Broker::spawn(
super::peer::actor(
server_id.clone(),
super::peer::Connect::ClientStream{stream},
selective_replication
)
);
}
} else {
break;
Expand Down

0 comments on commit 5d35c02

Please sign in to comment.