diff options
Diffstat (limited to 'src/conn.rs')
-rw-r--r-- | src/conn.rs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/conn.rs b/src/conn.rs index 7ba15f9..0aee952 100644 --- a/src/conn.rs +++ b/src/conn.rs @@ -60,7 +60,7 @@ impl ServerConn { let read = TokioCompatExtRead::wrap(read); let write = TokioCompatExtWrite::wrap(write); - let (box_stream_read, box_stream_write) = + let (read, write) = BoxStream::from_handshake(read, write, handshake, 0x8000).split_read_write(); let (resp_send, resp_recv) = mpsc::unbounded_channel(); @@ -83,13 +83,13 @@ impl ServerConn { tokio::try_join!( async move { tokio::select!( - r = conn2.recv_loop(box_stream_read) => r, + r = conn2.recv_loop(read) => r, _ = await_exit(close_recv) => Ok(()), ) }, async move { tokio::select!( - r = conn3.send_loop(resp_recv, box_stream_write) => r, + r = conn3.send_loop(resp_recv, write) => r, _ = await_exit(close_recv2) => Ok(()), ) }, @@ -174,7 +174,7 @@ impl ClientConn { let read = TokioCompatExtRead::wrap(read); let write = TokioCompatExtWrite::wrap(write); - let (box_stream_read, box_stream_write) = + let (read, write) = BoxStream::from_handshake(read, write, handshake, 0x8000).split_read_write(); let (query_send, query_recv) = mpsc::unbounded_channel(); @@ -196,15 +196,12 @@ impl ClientConn { tokio::spawn(async move { let conn2 = conn.clone(); let conn3 = conn.clone(); - tokio::try_join!( - conn2.send_loop(query_recv, box_stream_write), - async move { - tokio::select!( - r = conn3.recv_loop(box_stream_read) => r, - _ = await_exit(stop_recv_loop_recv) => Ok(()), - ) - } - ) + tokio::try_join!(conn2.send_loop(query_recv, write), async move { + tokio::select!( + r = conn3.recv_loop(read) => r, + _ = await_exit(stop_recv_loop_recv) => Ok(()), + ) + }) .map(|_| ()) .log_err("ClientConn send_loop/recv_loop/dispatch_loop"); |