Skip to content

Commit b3013c1

Browse files
committed
tests/util/chaosproxy: Reduce clone() calls in server_loop() fn
1 parent ee164e4 commit b3013c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/tests/util/chaosproxy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl ChaosProxy {
7777
.expect("failed to send the restore_networking message");
7878
}
7979

80-
async fn server_loop(self: Arc<Self>, initial_listener: TcpListener) -> Result<(), Error> {
80+
async fn server_loop(&self, initial_listener: TcpListener) -> Result<(), Error> {
8181
let mut listener = Some(initial_listener);
8282

8383
let mut break_networking_recv = self.break_networking_send.subscribe();
@@ -87,7 +87,7 @@ impl ChaosProxy {
8787
if let Some(l) = &listener {
8888
tokio::select! {
8989
accepted = l.accept() => {
90-
self.clone().accept_connection(accepted?.0).await?;
90+
self.accept_connection(accepted?.0).await?;
9191
},
9292

9393
_ = break_networking_recv.recv() => {
@@ -104,7 +104,7 @@ impl ChaosProxy {
104104
}
105105
}
106106

107-
async fn accept_connection(self: Arc<Self>, accepted: TcpStream) -> Result<(), Error> {
107+
async fn accept_connection(&self, accepted: TcpStream) -> Result<(), Error> {
108108
let (client_read, client_write) = accepted.into_split();
109109
let (backend_read, backend_write) = TcpStream::connect(&self.backend_address)
110110
.await?

0 commit comments

Comments
 (0)