dash map in muxer

This commit is contained in:
2026-03-21 20:27:02 +07:00
parent 2777e7fd24
commit e39fa755db
8 changed files with 56 additions and 32 deletions
+5 -5
View File
@@ -45,7 +45,7 @@ impl TcpConnection {
// ИСПРАВЛЕНИЕ: Даем Муксеру ограниченный канал, как он и просит (тип mpsc::Sender)
// Делаем его достаточно вместительным (1024)
let (v_tx, mut v_rx) = mpsc::channel::<Bytes>(1024);
muxer.register_stream(stream_id, v_tx).await;
muxer.register_stream(stream_id, v_tx);
let connect_payload = target_addr.to_string();
if muxer
@@ -57,7 +57,7 @@ impl TcpConnection {
.await
.is_err()
{
muxer.remove_stream(stream_id).await;
muxer.remove_stream(stream_id);
return;
}
@@ -68,13 +68,13 @@ impl TcpConnection {
let _ = handshake_tx.send(());
} else {
netrunner_logger::warn!(stream_id, "Server rejected TCP connection");
muxer.remove_stream(stream_id).await;
muxer.remove_stream(stream_id);
return;
}
}
_ => {
netrunner_logger::error!(stream_id, "Timeout waiting for proxy response");
muxer.remove_stream(stream_id).await;
muxer.remove_stream(stream_id);
return;
}
}
@@ -118,7 +118,7 @@ impl TcpConnection {
data: Bytes::new(),
})
.await;
muxer.remove_stream(stream_id).await;
muxer.remove_stream(stream_id);
});
Self {
+2 -2
View File
@@ -41,7 +41,7 @@ impl UdpConnection {
tokio::spawn(async move {
// Даем Муксеру ограниченный канал (тип Sender), чтобы компилятор пропустил
let (v_tx, mut v_rx) = mpsc::channel::<Bytes>(1024);
m_clone.register_stream(stream_id, v_tx).await;
m_clone.register_stream(stream_id, v_tx);
let _ = m_clone
.send_to_netwrok(MuxMessage {
@@ -81,7 +81,7 @@ impl UdpConnection {
data: Bytes::new(),
})
.await;
m_clone.remove_stream(stream_id).await;
m_clone.remove_stream(stream_id);
});
Self {