🐛 bug: fix compile bugs for tests

main
_ 2021-10-10 18:24:35 +00:00
parent b21f8a7c50
commit 1a775622cf
4 changed files with 19 additions and 1 deletions

1
Cargo.lock generated
View File

@ -1228,6 +1228,7 @@ name = "ptth_multi_call_server"
version = "0.1.0"
dependencies = [
"anyhow",
"ctrlc",
"ptth_file_server",
"ptth_server",
"quic_demo",

View File

@ -7,6 +7,7 @@ license = "AGPL-3.0"
[dependencies]
anyhow = "1.0.38"
ctrlc = "3.2.1"
ptth_file_server = { path = "../ptth_file_server_bin" }
ptth_server = { path = "../ptth_server" }
quic_demo = { path = "../../prototypes/quic_demo" }

View File

@ -3,6 +3,8 @@ use std::{
iter::FromIterator,
};
use tokio::sync::watch;
#[derive (Clone, Copy, Debug, PartialEq)]
enum Subcommand {
PtthServer,
@ -20,7 +22,17 @@ async fn main () -> anyhow::Result <()> {
match subcommand {
Subcommand::PtthServer => ptth_server::executable::main (&args).await,
Subcommand::PtthFileServer => ptth_file_server::main (&args).await,
Subcommand::PtthQuicEndServer => quic_demo::executable_end_server::main (&args).await,
Subcommand::PtthQuicEndServer => {
let (shutdown_tx, shutdown_rx) = watch::channel (false);
ctrlc::set_handler (move || {
shutdown_tx.send (true).expect ("Couldn't forward Ctrl+C signal");
})?;
tracing::trace! ("Set Ctrl+C handler");
quic_demo::executable_end_server::main (&args, Some (shutdown_rx)).await?;
Ok (())
}
}
}

View File

@ -79,8 +79,12 @@ impl P2Client {
let server_id = conf.server_id.clone ();
let server_tcp_port = conf.server_tcp_port;
let listener = TcpListener::bind (("127.0.0.1", client_tcp_port)).await?;
trace! ("Accepting local TCP connections from P1 on {}", client_tcp_port);
tokio::spawn (async move {
forward_port (
listener,
connection,
ForwardingParams {
client_tcp_port,