mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-14 09:53:48 +00:00
Refactored networking code
This commit is contained in:
3 files changed
+8
-5
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
pub mod encryption;
|
pub mod encryption;
|
||||||
pub mod log;
|
pub mod log;
|
||||||
pub mod environment;
|
pub mod environment;
|
||||||
|
pub mod network;
|
||||||
@@ -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() {
|
fn stop_servers() {
|
||||||
if let Some(server_process) = DOTNET_SERVER.lock().unwrap().take() {
|
if let Some(server_process) = DOTNET_SERVER.lock().unwrap().take() {
|
||||||
|
|||||||
@@ -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()
|
||||||
|
}
|
||||||
Reference in new issue
Block a user