🐛 bug: fix compile bugs for tests
parent
b21f8a7c50
commit
1a775622cf
|
@ -1228,6 +1228,7 @@ name = "ptth_multi_call_server"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"ctrlc",
|
||||||
"ptth_file_server",
|
"ptth_file_server",
|
||||||
"ptth_server",
|
"ptth_server",
|
||||||
"quic_demo",
|
"quic_demo",
|
||||||
|
|
|
@ -7,6 +7,7 @@ license = "AGPL-3.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.38"
|
anyhow = "1.0.38"
|
||||||
|
ctrlc = "3.2.1"
|
||||||
ptth_file_server = { path = "../ptth_file_server_bin" }
|
ptth_file_server = { path = "../ptth_file_server_bin" }
|
||||||
ptth_server = { path = "../ptth_server" }
|
ptth_server = { path = "../ptth_server" }
|
||||||
quic_demo = { path = "../../prototypes/quic_demo" }
|
quic_demo = { path = "../../prototypes/quic_demo" }
|
||||||
|
|
|
@ -3,6 +3,8 @@ use std::{
|
||||||
iter::FromIterator,
|
iter::FromIterator,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use tokio::sync::watch;
|
||||||
|
|
||||||
#[derive (Clone, Copy, Debug, PartialEq)]
|
#[derive (Clone, Copy, Debug, PartialEq)]
|
||||||
enum Subcommand {
|
enum Subcommand {
|
||||||
PtthServer,
|
PtthServer,
|
||||||
|
@ -20,7 +22,17 @@ async fn main () -> anyhow::Result <()> {
|
||||||
match subcommand {
|
match subcommand {
|
||||||
Subcommand::PtthServer => ptth_server::executable::main (&args).await,
|
Subcommand::PtthServer => ptth_server::executable::main (&args).await,
|
||||||
Subcommand::PtthFileServer => ptth_file_server::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 (())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,8 +79,12 @@ impl P2Client {
|
||||||
let server_id = conf.server_id.clone ();
|
let server_id = conf.server_id.clone ();
|
||||||
let server_tcp_port = conf.server_tcp_port;
|
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 {
|
tokio::spawn (async move {
|
||||||
forward_port (
|
forward_port (
|
||||||
|
listener,
|
||||||
connection,
|
connection,
|
||||||
ForwardingParams {
|
ForwardingParams {
|
||||||
client_tcp_port,
|
client_tcp_port,
|
||||||
|
|
Loading…
Reference in New Issue