feat: upgrade to donglora-client 0.2, fix org URLs, publish-ready
- Upgrade donglora-client from 0.1 (monorepo path dep) to 0.2 (crates.io) - Import wire-level constants from donglora_client::protocol::* - Fix repository URL to github.com/donglora/mux-rs - Add homepage, rust-version, exclude to Cargo.toml - Fix README (remove monorepo paths, add install instructions) - Allow clippy unwrap in test module
This commit is contained in:
8 files changed
+67
-110
No files matched your search
@@ -1,5 +1,18 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.2.0 — 2026-04-07
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Upgraded to `donglora-client` 0.2 (published crate, no more monorepo path dep).
|
||||||
|
- Wire-level protocol constants now imported from `donglora_client::protocol::*`.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Repository URL now points to `github.com/donglora/mux-rs`.
|
||||||
|
- README links updated (removed stale monorepo paths).
|
||||||
|
- Added `rust-version`, `homepage`, and `exclude` to Cargo.toml.
|
||||||
|
|
||||||
## 0.1.1 — 2026-04-06
|
## 0.1.1 — 2026-04-06
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
Generated
+4
-2
@@ -161,7 +161,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "donglora-client"
|
name = "donglora-client"
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1936935d31ab56a8cd70ceecfd6d447f2628a73a123e1cfe37ee4987eab0fa70"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"serialport",
|
"serialport",
|
||||||
@@ -171,7 +173,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "donglora-mux"
|
name = "donglora-mux"
|
||||||
version = "0.1.1"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
|
|||||||
+6
-3
@@ -1,16 +1,19 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "donglora-mux"
|
name = "donglora-mux"
|
||||||
version = "0.1.1"
|
version = "0.2.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
rust-version = "1.85"
|
||||||
authors = ["Stephen Waits <steve@waits.net>"]
|
authors = ["Stephen Waits <steve@waits.net>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
description = "DongLoRa USB Multiplexer — share one dongle with multiple applications"
|
description = "DongLoRa USB Multiplexer — share one dongle with multiple applications"
|
||||||
repository = "https://github.com/swaits/donglora"
|
repository = "https://github.com/donglora/mux-rs"
|
||||||
|
homepage = "https://github.com/donglora/mux-rs"
|
||||||
keywords = ["lora", "radio", "usb", "multiplexer"]
|
keywords = ["lora", "radio", "usb", "multiplexer"]
|
||||||
categories = ["hardware-support"]
|
categories = ["hardware-support"]
|
||||||
|
exclude = [".jj/", "deny.toml", "justfile", "mise.toml", "rustfmt.toml"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
donglora-client = { version = "0.1.0", path = "../../clients/rust" }
|
donglora-client = "0.2"
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
clap = { version = "4", features = ["derive"] }
|
clap = { version = "4", features = ["derive"] }
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
USB multiplexer daemon — lets multiple applications share one DongLoRa
|
USB multiplexer daemon — lets multiple applications share one DongLoRa
|
||||||
dongle simultaneously.
|
dongle simultaneously.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cargo install donglora-mux
|
||||||
|
```
|
||||||
|
|
||||||
## What It Does
|
## What It Does
|
||||||
|
|
||||||
- Owns the USB serial connection exclusively
|
- Owns the USB serial connection exclusively
|
||||||
@@ -18,12 +24,12 @@ dongle simultaneously.
|
|||||||
## Running
|
## Running
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
just run # start the mux daemon
|
donglora-mux # start the mux daemon
|
||||||
just verbose # start with verbose logging
|
donglora-mux --verbose # start with verbose logging
|
||||||
just run -- --tcp 5741 --port /dev/ttyACM0 # with options
|
donglora-mux --tcp 5741 --port /dev/ttyACM0 # with options
|
||||||
```
|
```
|
||||||
|
|
||||||
## Depends On
|
## Depends On
|
||||||
|
|
||||||
- [clients/rust](../../clients/rust/) — the `donglora-client` library
|
- [`donglora-client`](https://crates.io/crates/donglora-client) — protocol
|
||||||
(protocol types, COBS framing, device discovery)
|
types, COBS framing, device discovery
|
||||||
+19
-58
@@ -9,13 +9,13 @@ use std::path::Path;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use donglora_client::{
|
use donglora_client::protocol::{
|
||||||
encode_frame, FrameReader, CMD_TAG_SET_CONFIG, CMD_TAG_START_RX, CMD_TAG_STOP_RX,
|
CMD_TAG_SET_CONFIG, CMD_TAG_START_RX, CMD_TAG_STOP_RX, RADIO_CONFIG_SIZE, RESP_TAG_OK, RESP_TAG_RX_PACKET,
|
||||||
RADIO_CONFIG_SIZE, RESP_TAG_OK, RESP_TAG_RX_PACKET,
|
|
||||||
};
|
};
|
||||||
|
use donglora_client::{FrameReader, encode_frame};
|
||||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||||
use tokio::net::{TcpListener, UnixListener};
|
use tokio::net::{TcpListener, UnixListener};
|
||||||
use tokio::sync::{mpsc, oneshot, Mutex};
|
use tokio::sync::{Mutex, mpsc, oneshot};
|
||||||
|
|
||||||
/// A queued command: (client_id, raw_cmd_bytes).
|
/// A queued command: (client_id, raw_cmd_bytes).
|
||||||
type QueuedCmd = (u64, Vec<u8>);
|
type QueuedCmd = (u64, Vec<u8>);
|
||||||
@@ -63,28 +63,20 @@ impl MuxDaemon {
|
|||||||
tcp_addr: Option<(String, u16)>,
|
tcp_addr: Option<(String, u16)>,
|
||||||
shutdown: CancellationToken,
|
shutdown: CancellationToken,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self { serial_port, socket_path, tcp_addr, shutdown }
|
||||||
serial_port,
|
|
||||||
socket_path,
|
|
||||||
tcp_addr,
|
|
||||||
shutdown,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run the mux daemon. Returns when shutdown is signalled.
|
/// Run the mux daemon. Returns when shutdown is signalled.
|
||||||
pub async fn run(&self) -> anyhow::Result<()> {
|
pub async fn run(&self) -> anyhow::Result<()> {
|
||||||
let state: SharedState = Arc::new(Mutex::new(MuxInner {
|
let state: SharedState =
|
||||||
sessions: HashMap::new(),
|
Arc::new(Mutex::new(MuxInner { sessions: HashMap::new(), mux_state: MuxState::new() }));
|
||||||
mux_state: MuxState::new(),
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Command channel: client handlers → dongle writer
|
// Command channel: client handlers → dongle writer
|
||||||
let (cmd_tx, cmd_rx) = mpsc::channel::<(u64, Vec<u8>)>(64);
|
let (cmd_tx, cmd_rx) = mpsc::channel::<(u64, Vec<u8>)>(64);
|
||||||
let cmd_rx = Arc::new(Mutex::new(cmd_rx));
|
let cmd_rx = Arc::new(Mutex::new(cmd_rx));
|
||||||
|
|
||||||
// Pending response slot: dongle writer installs, dongle reader resolves
|
// Pending response slot: dongle writer installs, dongle reader resolves
|
||||||
let pending_response: Arc<Mutex<Option<oneshot::Sender<Vec<u8>>>>> =
|
let pending_response: Arc<Mutex<Option<oneshot::Sender<Vec<u8>>>>> = Arc::new(Mutex::new(None));
|
||||||
Arc::new(Mutex::new(None));
|
|
||||||
|
|
||||||
// Prepare socket directory
|
// Prepare socket directory
|
||||||
let sock_path = Path::new(&self.socket_path);
|
let sock_path = Path::new(&self.socket_path);
|
||||||
@@ -134,24 +126,13 @@ impl MuxDaemon {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Spawn client accept tasks
|
// Spawn client accept tasks
|
||||||
tokio::spawn(accept_unix_clients(
|
tokio::spawn(accept_unix_clients(unix_listener, state.clone(), cmd_tx.clone(), self.shutdown.clone()));
|
||||||
unix_listener,
|
|
||||||
state.clone(),
|
|
||||||
cmd_tx.clone(),
|
|
||||||
self.shutdown.clone(),
|
|
||||||
));
|
|
||||||
if let Some(listener) = tcp_listener {
|
if let Some(listener) = tcp_listener {
|
||||||
tokio::spawn(accept_tcp_clients(
|
tokio::spawn(accept_tcp_clients(listener, state.clone(), cmd_tx.clone(), self.shutdown.clone()));
|
||||||
listener,
|
|
||||||
state.clone(),
|
|
||||||
cmd_tx.clone(),
|
|
||||||
self.shutdown.clone(),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect/reconnect loop
|
// Connect/reconnect loop
|
||||||
self.reconnect_loop(state, cmd_tx, cmd_rx, pending_response)
|
self.reconnect_loop(state, cmd_tx, cmd_rx, pending_response).await;
|
||||||
.await;
|
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
info!("shutting down...");
|
info!("shutting down...");
|
||||||
@@ -245,8 +226,8 @@ impl MuxDaemon {
|
|||||||
|
|
||||||
async fn open_and_ping(port: &str) -> anyhow::Result<tokio_serial::SerialStream> {
|
async fn open_and_ping(port: &str) -> anyhow::Result<tokio_serial::SerialStream> {
|
||||||
let builder = tokio_serial::new(port, 115_200).timeout(Duration::from_secs(2));
|
let builder = tokio_serial::new(port, 115_200).timeout(Duration::from_secs(2));
|
||||||
let mut serial = tokio_serial::SerialStream::open(&builder)
|
let mut serial =
|
||||||
.map_err(|e| anyhow::anyhow!("failed to open {port}: {e}"))?;
|
tokio_serial::SerialStream::open(&builder).map_err(|e| anyhow::anyhow!("failed to open {port}: {e}"))?;
|
||||||
|
|
||||||
let ping_frame = encode_frame(&[0]);
|
let ping_frame = encode_frame(&[0]);
|
||||||
AsyncWriteExt::write_all(&mut serial, &ping_frame)
|
AsyncWriteExt::write_all(&mut serial, &ping_frame)
|
||||||
@@ -360,9 +341,7 @@ async fn dispatch_frame(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn resolve_pending_with_error(
|
async fn resolve_pending_with_error(pending_response: &Arc<Mutex<Option<oneshot::Sender<Vec<u8>>>>>) {
|
||||||
pending_response: &Arc<Mutex<Option<oneshot::Sender<Vec<u8>>>>>,
|
|
||||||
) {
|
|
||||||
let mut slot = pending_response.lock().await;
|
let mut slot = pending_response.lock().await;
|
||||||
if let Some(sender) = slot.take() {
|
if let Some(sender) = slot.take() {
|
||||||
let _ = sender.send(vec![5, 1]); // Error(RadioBusy)
|
let _ = sender.send(vec![5, 1]); // Error(RadioBusy)
|
||||||
@@ -397,12 +376,7 @@ async fn dongle_writer(
|
|||||||
let intercepted = {
|
let intercepted = {
|
||||||
let mut inner = state.lock().await;
|
let mut inner = state.lock().await;
|
||||||
let locked = inner.mux_state.locked_config;
|
let locked = inner.mux_state.locked_config;
|
||||||
intercept::maybe_intercept(
|
intercept::maybe_intercept(&raw_cmd, client_id, &mut inner.sessions, &locked)
|
||||||
&raw_cmd,
|
|
||||||
client_id,
|
|
||||||
&mut inner.sessions,
|
|
||||||
&locked,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
if let Some(synthetic) = intercepted {
|
if let Some(synthetic) = intercepted {
|
||||||
let inner = state.lock().await;
|
let inner = state.lock().await;
|
||||||
@@ -607,27 +581,16 @@ async fn client_writer<W: AsyncWriteExt + Unpin>(
|
|||||||
() = shutdown.cancelled() => return,
|
() = shutdown.cancelled() => return,
|
||||||
};
|
};
|
||||||
|
|
||||||
if AsyncWriteExt::write_all(&mut write_half, &frame)
|
if AsyncWriteExt::write_all(&mut write_half, &frame).await.is_err() {
|
||||||
.await
|
|
||||||
.is_err()
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn remove_client(
|
async fn remove_client(client_id: u64, state: &SharedState, label: &str, cmd_tx: &mpsc::Sender<(u64, Vec<u8>)>) {
|
||||||
client_id: u64,
|
|
||||||
state: &SharedState,
|
|
||||||
label: &str,
|
|
||||||
cmd_tx: &mpsc::Sender<(u64, Vec<u8>)>,
|
|
||||||
) {
|
|
||||||
let mut inner = state.lock().await;
|
let mut inner = state.lock().await;
|
||||||
|
|
||||||
let was_interested = inner
|
let was_interested = inner.sessions.get(&client_id).is_some_and(|s| s.rx_interested);
|
||||||
.sessions
|
|
||||||
.get(&client_id)
|
|
||||||
.is_some_and(|s| s.rx_interested);
|
|
||||||
|
|
||||||
inner.sessions.remove(&client_id);
|
inner.sessions.remove(&client_id);
|
||||||
info!("{label} disconnected ({} remain)", inner.sessions.len());
|
info!("{label} disconnected ({} remain)", inner.sessions.len());
|
||||||
@@ -637,9 +600,7 @@ async fn remove_client(
|
|||||||
info!("last RX-interested client gone — sending StopRx");
|
info!("last RX-interested client gone — sending StopRx");
|
||||||
// Drop the lock before sending to avoid deadlock
|
// Drop the lock before sending to avoid deadlock
|
||||||
drop(inner);
|
drop(inner);
|
||||||
let _ = cmd_tx
|
let _ = cmd_tx.send((SYNTHETIC_CLIENT_ID, vec![CMD_TAG_STOP_RX])).await;
|
||||||
.send((SYNTHETIC_CLIENT_ID, vec![CMD_TAG_STOP_RX]))
|
|
||||||
.await;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-34
@@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use donglora_client::{
|
use donglora_client::protocol::{
|
||||||
CMD_TAG_SET_CONFIG, CMD_TAG_START_RX, CMD_TAG_STOP_RX, ERROR_INVALID_CONFIG, RADIO_CONFIG_SIZE,
|
CMD_TAG_SET_CONFIG, CMD_TAG_START_RX, CMD_TAG_STOP_RX, ERROR_INVALID_CONFIG, RADIO_CONFIG_SIZE, RESP_TAG_ERROR,
|
||||||
RESP_TAG_ERROR, RESP_TAG_OK,
|
RESP_TAG_OK,
|
||||||
};
|
};
|
||||||
use tracing::{debug, warn};
|
use tracing::{debug, warn};
|
||||||
|
|
||||||
@@ -22,9 +22,7 @@ pub struct MuxState {
|
|||||||
|
|
||||||
impl MuxState {
|
impl MuxState {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self { locked_config: None }
|
||||||
locked_config: None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,27 +65,18 @@ fn intercept_set_config(
|
|||||||
|
|
||||||
// Same config — reply Ok without hitting the dongle
|
// Same config — reply Ok without hitting the dongle
|
||||||
if config_bytes == locked.as_slice() {
|
if config_bytes == locked.as_slice() {
|
||||||
let label = sessions
|
let label = sessions.get(&client_id).map(ClientSession::label).unwrap_or_else(|| format!("id-{client_id}"));
|
||||||
.get(&client_id)
|
|
||||||
.map(ClientSession::label)
|
|
||||||
.unwrap_or_else(|| format!("id-{client_id}"));
|
|
||||||
debug!("{label}: SetConfig matches locked config — Ok");
|
debug!("{label}: SetConfig matches locked config — Ok");
|
||||||
return Some(vec![RESP_TAG_OK]);
|
return Some(vec![RESP_TAG_OK]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Different config — reject
|
// Different config — reject
|
||||||
let label = sessions
|
let label = sessions.get(&client_id).map(ClientSession::label).unwrap_or_else(|| format!("id-{client_id}"));
|
||||||
.get(&client_id)
|
|
||||||
.map(ClientSession::label)
|
|
||||||
.unwrap_or_else(|| format!("id-{client_id}"));
|
|
||||||
warn!("{label}: SetConfig rejected (conflicts with locked config)");
|
warn!("{label}: SetConfig rejected (conflicts with locked config)");
|
||||||
Some(vec![RESP_TAG_ERROR, ERROR_INVALID_CONFIG])
|
Some(vec![RESP_TAG_ERROR, ERROR_INVALID_CONFIG])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn intercept_start_rx(
|
fn intercept_start_rx(client_id: u64, sessions: &mut HashMap<u64, ClientSession>) -> Option<Vec<u8>> {
|
||||||
client_id: u64,
|
|
||||||
sessions: &mut HashMap<u64, ClientSession>,
|
|
||||||
) -> Option<Vec<u8>> {
|
|
||||||
let client = sessions.get(&client_id)?;
|
let client = sessions.get(&client_id)?;
|
||||||
|
|
||||||
// Already interested — no-op
|
// Already interested — no-op
|
||||||
@@ -107,10 +96,7 @@ fn intercept_start_rx(
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn intercept_stop_rx(
|
fn intercept_stop_rx(client_id: u64, sessions: &mut HashMap<u64, ClientSession>) -> Option<Vec<u8>> {
|
||||||
client_id: u64,
|
|
||||||
sessions: &mut HashMap<u64, ClientSession>,
|
|
||||||
) -> Option<Vec<u8>> {
|
|
||||||
let client = sessions.get(&client_id)?;
|
let client = sessions.get(&client_id)?;
|
||||||
|
|
||||||
// Wasn't interested — no-op
|
// Wasn't interested — no-op
|
||||||
@@ -140,6 +126,7 @@ pub fn rx_interest_count(sessions: &HashMap<u64, ClientSession>) -> usize {
|
|||||||
// ── Tests ──────────────────────────────────────────────────────────
|
// ── Tests ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
#[allow(clippy::unwrap_used)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
@@ -201,10 +188,7 @@ mod tests {
|
|||||||
let id = first_id(&sessions);
|
let id = first_id(&sessions);
|
||||||
let mut cmd = vec![CMD_TAG_SET_CONFIG];
|
let mut cmd = vec![CMD_TAG_SET_CONFIG];
|
||||||
cmd.extend_from_slice(&[99, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]);
|
cmd.extend_from_slice(&[99, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]);
|
||||||
assert_eq!(
|
assert_eq!(maybe_intercept(&cmd, id, &mut sessions, &locked), Some(vec![RESP_TAG_ERROR, ERROR_INVALID_CONFIG]));
|
||||||
maybe_intercept(&cmd, id, &mut sessions, &locked),
|
|
||||||
Some(vec![RESP_TAG_ERROR, ERROR_INVALID_CONFIG])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── StartRx ────────────────────────────────────────────────────
|
// ── StartRx ────────────────────────────────────────────────────
|
||||||
@@ -223,10 +207,7 @@ mod tests {
|
|||||||
let locked = None;
|
let locked = None;
|
||||||
let id = first_id(&sessions);
|
let id = first_id(&sessions);
|
||||||
sessions.get_mut(&id).unwrap().rx_interested = true;
|
sessions.get_mut(&id).unwrap().rx_interested = true;
|
||||||
assert_eq!(
|
assert_eq!(maybe_intercept(&[CMD_TAG_START_RX], id, &mut sessions, &locked), Some(vec![RESP_TAG_OK]));
|
||||||
maybe_intercept(&[CMD_TAG_START_RX], id, &mut sessions, &locked),
|
|
||||||
Some(vec![RESP_TAG_OK])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -248,10 +229,7 @@ mod tests {
|
|||||||
let mut sessions = make_sessions(1);
|
let mut sessions = make_sessions(1);
|
||||||
let locked = None;
|
let locked = None;
|
||||||
let id = first_id(&sessions);
|
let id = first_id(&sessions);
|
||||||
assert_eq!(
|
assert_eq!(maybe_intercept(&[CMD_TAG_STOP_RX], id, &mut sessions, &locked), Some(vec![RESP_TAG_OK]));
|
||||||
maybe_intercept(&[CMD_TAG_STOP_RX], id, &mut sessions, &locked),
|
|
||||||
Some(vec![RESP_TAG_OK])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
+1
-3
@@ -61,9 +61,7 @@ async fn main() -> anyhow::Result<()> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Resolve socket path
|
// Resolve socket path
|
||||||
let socket_path = args
|
let socket_path = args.socket.unwrap_or_else(donglora_client::default_socket_path);
|
||||||
.socket
|
|
||||||
.unwrap_or_else(donglora_client::default_socket_path);
|
|
||||||
|
|
||||||
// Parse TCP address
|
// Parse TCP address
|
||||||
let tcp_addr = parse_tcp_addr(&args.tcp);
|
let tcp_addr = parse_tcp_addr(&args.tcp);
|
||||||
|
|||||||
+1
-5
@@ -30,11 +30,7 @@ impl ClientSession {
|
|||||||
pub fn new() -> (Self, mpsc::Receiver<Vec<u8>>) {
|
pub fn new() -> (Self, mpsc::Receiver<Vec<u8>>) {
|
||||||
let id = NEXT_CLIENT_ID.fetch_add(1, Ordering::Relaxed);
|
let id = NEXT_CLIENT_ID.fetch_add(1, Ordering::Relaxed);
|
||||||
let (tx, rx) = mpsc::channel(SEND_QUEUE_CAP);
|
let (tx, rx) = mpsc::channel(SEND_QUEUE_CAP);
|
||||||
let session = Self {
|
let session = Self { id, rx_interested: false, tx };
|
||||||
id,
|
|
||||||
rx_interested: false,
|
|
||||||
tx,
|
|
||||||
};
|
|
||||||
(session, rx)
|
(session, rx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user