Skip to content

Commit 2a5393d

Browse files
stun client: remove unnecessary mut (#652)
1 parent b0630f4 commit 2a5393d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

stun/src/client.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,12 @@ impl Client {
246246
}
247247
}
248248

249-
fn insert(&mut self, ct: ClientTransaction) -> Result<()> {
249+
fn insert(&self, ct: ClientTransaction) -> Result<()> {
250250
if self.settings.closed {
251251
return Err(Error::ErrClientClosed);
252252
}
253253

254-
if let Some(handler_tx) = &mut self.handler_tx {
254+
if let Some(handler_tx) = &self.handler_tx {
255255
handler_tx.send(Event {
256256
event_type: EventType::Insert(ct),
257257
..Default::default()
@@ -261,12 +261,12 @@ impl Client {
261261
Ok(())
262262
}
263263

264-
fn remove(&mut self, id: TransactionId) -> Result<()> {
264+
fn remove(&self, id: TransactionId) -> Result<()> {
265265
if self.settings.closed {
266266
return Err(Error::ErrClientClosed);
267267
}
268268

269-
if let Some(handler_tx) = &mut self.handler_tx {
269+
if let Some(handler_tx) = &self.handler_tx {
270270
handler_tx.send(Event {
271271
event_type: EventType::Remove(id),
272272
..Default::default()
@@ -426,7 +426,7 @@ impl Client {
426426
Ok(self)
427427
}
428428

429-
pub async fn send(&mut self, m: &Message, handler: Handler) -> Result<()> {
429+
pub async fn send(&self, m: &Message, handler: Handler) -> Result<()> {
430430
if self.settings.closed {
431431
return Err(Error::ErrClientClosed);
432432
}
@@ -446,7 +446,7 @@ impl Client {
446446
let d = t.next_timeout(t.start);
447447
self.insert(t)?;
448448

449-
if let Some(client_agent_tx) = &mut self.client_agent_tx {
449+
if let Some(client_agent_tx) = &self.client_agent_tx {
450450
client_agent_tx
451451
.send(ClientAgent::Start(m.transaction_id, d))
452452
.await?;
@@ -458,7 +458,7 @@ impl Client {
458458
if result.is_err() && has_handler {
459459
self.remove(m.transaction_id)?;
460460

461-
if let Some(client_agent_tx) = &mut self.client_agent_tx {
461+
if let Some(client_agent_tx) = &self.client_agent_tx {
462462
client_agent_tx
463463
.send(ClientAgent::Stop(m.transaction_id))
464464
.await?;

0 commit comments

Comments
 (0)