Skip to content

Commit

Permalink
Wrap passthru in mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
akiroz committed Jan 20, 2024
1 parent 193d0de commit 52b6d6c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zika"
version = "3.3.0"
version = "3.3.1"
license = "MIT"
description = "IP Tunneling over MQTT"
repository = "https://github.com/akiroz/zika"
Expand Down
4 changes: 2 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct Client {
pub local_addr: Ipv4Addr,
tunnels: Arc<Vec<Tunnel>>,
pub remote: Arc<Mutex<remote::Remote>>, // Allow external mqtt ops
pub remote_passthru_recv: broadcast::Receiver<(String, Bytes)>,
pub remote_passthru_recv: Arc<Mutex<broadcast::Receiver<(String, Bytes)>>>,
}

struct Tunnel {
Expand Down Expand Up @@ -100,7 +100,7 @@ impl Client {
local_addr,
tunnels: Arc::new(tunnels),
remote: Arc::new(Mutex::new(remote)),
remote_passthru_recv,
remote_passthru_recv: Arc::new(Mutex::new(remote_passthru_recv)),
});

let loop_client = client.clone();
Expand Down
5 changes: 2 additions & 3 deletions src/remote.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use bytes::Bytes;
use log;
use bytes::Bytes;
use rumqttc::v5::{
self as mqtt,
mqttbytes::{v5::Packet, QoS},
};
use std::sync::Arc;
use tokio::sync::Mutex;
use tokio::{sync::mpsc, task};
use tokio::{sync::{mpsc, Mutex}, task};

use crate::lookup_pool::LookupPool;
use rumqttc::v5::mqttbytes::v5::PublishProperties;
Expand Down

0 comments on commit 52b6d6c

Please sign in to comment.