remove old unused TCP server from PTTH_QUIC relay

main
(on company time) 2022-10-31 12:55:29 -05:00
parent 036193a19e
commit 963631ff96
1 changed files with 2 additions and 38 deletions

View File

@ -21,6 +21,8 @@ use protocol::PeerId;
pub struct Opt {
#[structopt (long)]
listen_addr: Option <String>,
#[structopt (long)]
tcp_listen_addr: Option <String>,
}
pub async fn main (opt: Opt) -> anyhow::Result <()>
@ -52,9 +54,6 @@ pub async fn main (opt: Opt) -> anyhow::Result <()>
let http_addr = SocketAddr::from (([0, 0, 0, 0], 4004));
let http_server = Server::bind (&http_addr);
let tcp_port = 30382;
let tcp_listener = TcpListener::bind (("127.0.0.1", tcp_port)).await?;
let task_quic_server = {
let relay_state = Arc::clone (&relay_state);
tokio::spawn (async move {
@ -114,45 +113,10 @@ pub async fn main (opt: Opt) -> anyhow::Result <()>
Ok::<_, anyhow::Error> (())
});
let task_tcp_server = {
let relay_state = Arc::clone (&relay_state);
tokio::spawn (async move {
loop {
let (tcp_socket, _) = tcp_listener.accept ().await?;
let relay_state = Arc::clone (&relay_state);
tokio::spawn (async move {
let (_client_recv, _client_send) = tcp_socket.into_split ();
debug! ("Accepted direct TCP connection P1 --> P3");
let p4_server_proxies = relay_state.p4_server_proxies.lock ().await;
let _p4 = match p4_server_proxies.get ("bogus_server") {
Some (x) => x,
None => bail! ("That server isn't connected"),
};
// unimplemented! ();
/*
p4.req_channel.send (RequestP2ToP4 {
client_send,
client_recv,
client_id: "bogus_client".to_string (),
}).await.map_err (|_| anyhow::anyhow! ("Can't send request to P4 server"))?;
*/
Ok (())
});
}
Ok::<_, anyhow::Error> (())
})
};
debug! ("Serving HTTP on {:?}", http_addr);
task_quic_server.await??;
task_http_server.await??;
task_tcp_server.await??;
task_direc_server.await??;
Ok (())