Skip to content

Commit

Permalink
refactor: remove &mut from Endpoint::disconnect_from
Browse files Browse the repository at this point in the history
  • Loading branch information
madadam committed Mar 11, 2021
1 parent 949fc4b commit 3196140
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/connection_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl ConnectionPool {
.is_some()
}

pub fn remove(&mut self, addr: &SocketAddr) -> Vec<quinn::Connection> {
pub fn remove(&self, addr: &SocketAddr) -> Vec<quinn::Connection> {
let mut store = self.store.lock().unwrap_or_else(PoisonError::into_inner);

let keys_to_remove = store
Expand Down
2 changes: 1 addition & 1 deletion src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl Endpoint {
}

/// Removes all existing connections to a given peer
pub fn disconnect_from(&mut self, peer_addr: &SocketAddr) -> Result<()> {
pub fn disconnect_from(&self, peer_addr: &SocketAddr) -> Result<()> {
self.connection_pool
.remove(peer_addr)
.iter()
Expand Down
4 changes: 2 additions & 2 deletions src/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ async fn disconnection() -> Result<()> {
utils::init_logging();

let qp2p = new_qp2p()?;
let (mut alice, mut alice_incoming_connections, _, mut alice_disconnections) =
let (alice, mut alice_incoming_connections, _, mut alice_disconnections) =
qp2p.new_endpoint().await?;
let alice_addr = alice.socket_addr();

Expand Down Expand Up @@ -234,7 +234,7 @@ async fn simultaneous_incoming_and_outgoing_connections() -> Result<()> {
) = qp2p.new_endpoint().await?;
let alice_addr = alice.socket_addr();

let (mut bob, mut bob_incoming_connections, mut bob_incoming_messages, _) =
let (bob, mut bob_incoming_connections, mut bob_incoming_messages, _) =
qp2p.new_endpoint().await?;
let bob_addr = bob.socket_addr();

Expand Down

0 comments on commit 3196140

Please sign in to comment.