Skip to content

Commit 030e8d9

Browse files
rklaehnmatheus23
andauthored
Update src/util/connection_pool.rs
Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
1 parent 93053c9 commit 030e8d9

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/util/connection_pool.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,21 @@ impl Context {
160160
) {
161161
let context = self;
162162

163-
let context2 = context.clone();
164-
let conn_fut = async move {
165-
let conn = context2
166-
.endpoint
167-
.connect(node_id, &context2.alpn)
168-
.await
169-
.map_err(PoolConnectError::from)?;
170-
if let Some(on_connect) = &context2.options.on_connected {
171-
on_connect(&context2.endpoint, &conn)
163+
let conn_fut = {
164+
let context = context.clone();
165+
async move {
166+
let conn = context
167+
.endpoint
168+
.connect(node_id, &context.alpn)
172169
.await
173170
.map_err(PoolConnectError::from)?;
171+
if let Some(on_connect) = &context.options.on_connected {
172+
on_connect(&context.endpoint, &conn)
173+
.await
174+
.map_err(PoolConnectError::from)?;
175+
}
176+
Result::<Connection, PoolConnectError>::Ok(conn)
174177
}
175-
Result::<Connection, PoolConnectError>::Ok(conn)
176178
};
177179

178180
// Connect to the node

0 commit comments

Comments
 (0)