mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
aquatic_ws: name worker threads
Note: simplelog doesn't seem to pick up thread names, but this commit is good anyway, since they can be displayed in e.g. htop on Linux
This commit is contained in:
parent
bc8916dce4
commit
66216657ec
1 changed files with 5 additions and 4 deletions
|
|
@ -2,6 +2,7 @@ use std::time::Duration;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use std::thread::Builder;
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use native_tls::{Identity, TlsAcceptor};
|
use native_tls::{Identity, TlsAcceptor};
|
||||||
|
|
@ -48,7 +49,7 @@ pub fn run(config: Config) -> anyhow::Result<()> {
|
||||||
|
|
||||||
out_message_senders.push(out_message_sender);
|
out_message_senders.push(out_message_sender);
|
||||||
|
|
||||||
::std::thread::spawn(move || {
|
Builder::new().name(format!("socket-{:02}", i + 1)).spawn(move || {
|
||||||
network::run_socket_worker(
|
network::run_socket_worker(
|
||||||
config,
|
config,
|
||||||
i,
|
i,
|
||||||
|
|
@ -57,7 +58,7 @@ pub fn run(config: Config) -> anyhow::Result<()> {
|
||||||
out_message_receiver,
|
out_message_receiver,
|
||||||
opt_tls_acceptor
|
opt_tls_acceptor
|
||||||
);
|
);
|
||||||
});
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for socket worker statuses. On error from any, quit program.
|
// Wait for socket worker statuses. On error from any, quit program.
|
||||||
|
|
@ -96,14 +97,14 @@ pub fn run(config: Config) -> anyhow::Result<()> {
|
||||||
let config = config.clone();
|
let config = config.clone();
|
||||||
let state = state.clone();
|
let state = state.clone();
|
||||||
|
|
||||||
::std::thread::spawn(move || {
|
Builder::new().name("request".to_string()).spawn(move || {
|
||||||
handler::run_request_worker(
|
handler::run_request_worker(
|
||||||
config,
|
config,
|
||||||
state,
|
state,
|
||||||
in_message_receiver,
|
in_message_receiver,
|
||||||
out_message_sender,
|
out_message_sender,
|
||||||
);
|
);
|
||||||
});
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue