Refactored networking code

This commit is contained in:
tsommer committed 2024-11-05 18:57:30 +01:00
1 parent 23bd11f4db
commit 45f0ab234f
3 files changed
+9 -6

No files matched your search

+2 -1
View File
@@ -1,3 +1,4 @@
pub mod encryption;
pub mod log;
pub mod environment;
pub mod environment;
pub mod network;
-5
View File
@@ -517,11 +517,6 @@ async fn dotnet_ready(_token: APIToken) {
}
}
fn get_available_port() -> Option<u16> {
TcpListener::bind(("127.0.0.1", 0))
.map(|listener| listener.local_addr().unwrap().port())
.ok()
}
fn stop_servers() {
if let Some(server_process) = DOTNET_SERVER.lock().unwrap().take() {
+7
View File
@@ -0,0 +1,7 @@
use std::net::TcpListener;
pub fn get_available_port() -> Option<u16> {
TcpListener::bind(("127.0.0.1", 0))
.map(|listener| listener.local_addr().unwrap().port())
.ok()
}