diff --git a/services/tunnelbroker/src/comm_server/mod.rs b/services/tunnelbroker/src/grpc/mod.rs rename from services/tunnelbroker/src/comm_server/mod.rs rename to services/tunnelbroker/src/grpc/mod.rs --- a/services/tunnelbroker/src/comm_server/mod.rs +++ b/services/tunnelbroker/src/grpc/mod.rs @@ -22,7 +22,7 @@ } } -pub async fn run_grpc_server() -> Result<(), tonic::transport::Error> { +pub async fn run_server() -> Result<(), tonic::transport::Error> { let addr = format!("[::1]:{}", constants::GRPC_SERVER_PORT) .parse() .expect("Unable to parse gRPC address"); diff --git a/services/tunnelbroker/src/main.rs b/services/tunnelbroker/src/main.rs --- a/services/tunnelbroker/src/main.rs +++ b/services/tunnelbroker/src/main.rs @@ -1,5 +1,5 @@ -pub mod comm_server; pub mod constants; +pub mod grpc; pub mod websockets; use std::io::{self, Error, ErrorKind}; use tracing; @@ -10,11 +10,11 @@ tracing::subscriber::set_global_default(subscriber) .expect("Unable to configure tracing"); - let comm_server = comm_server::run_grpc_server(); - let websocket_server = websockets::create_server(); + let grpc_server = grpc::run_server(); + let websocket_server = websockets::run_server(); tokio::select! { - Ok(_) = comm_server => { Ok(()) }, + Ok(_) = grpc_server => { Ok(()) }, Ok(_) = websocket_server => { Ok(()) }, else => { tracing::error!("A grpc or websocket server crashed."); diff --git a/services/tunnelbroker/src/websockets/mod.rs b/services/tunnelbroker/src/websockets/mod.rs --- a/services/tunnelbroker/src/websockets/mod.rs +++ b/services/tunnelbroker/src/websockets/mod.rs @@ -3,7 +3,7 @@ use tokio::net::{TcpListener, TcpStream}; use tracing::info; -pub async fn create_server() -> Result<(), Error> { +pub async fn run_server() -> Result<(), Error> { let addr = env::var("COMM_TUNNELBROKER_WEBSOCKET_ADDR") .unwrap_or_else(|_| "127.0.0.1:51001".to_string());