@@ -15,16 +15,11 @@ pub struct Connection {
1515 inbound_rx : mpsc:: Receiver < Request > ,
1616 outbound_tx : mpsc:: Sender < Sendable > ,
1717
18- // NOTE: The order matters here.
18+ // NOTE: The order of members matters here.
1919 // I/O threads must be dropped after the channels.
2020 _io_threads : IoThreads ,
2121}
2222
23- struct IoThreads {
24- pub reader : Option < JoinHandle < ( ) > > ,
25- pub writer : Option < JoinHandle < ( ) > > ,
26- }
27-
2823impl Connection {
2924 pub fn new ( ) -> Result < Self > {
3025 let tcp_listener = TcpListener :: bind ( "127.0.0.1:0" ) . map_err ( ServerError :: IoError ) ?;
@@ -49,7 +44,7 @@ impl Connection {
4944 }
5045
5146 pub fn next_request ( & self ) -> Result < Request > {
52- self . inbound_rx . recv ( ) . context ( "Connection close " )
47+ self . inbound_rx . recv ( ) . context ( "Inbound connection closed " )
5348 }
5449
5550 pub fn send_event ( & self , event : Event ) -> Result < ( ) > {
@@ -71,6 +66,11 @@ impl Connection {
7166 }
7267}
7368
69+ struct IoThreads {
70+ pub reader : Option < JoinHandle < ( ) > > ,
71+ pub writer : Option < JoinHandle < ( ) > > ,
72+ }
73+
7474impl IoThreads {
7575 fn spawn (
7676 server_reader : ServerReader < TcpStream > ,
@@ -119,7 +119,7 @@ fn spawn_writer_thread(
119119 Sendable :: Event ( event) => {
120120 server_writer. send_event ( event) . expect ( "Failed to send event" )
121121 }
122- Sendable :: ReverseRequest ( _) => unreachable ! ( ) ,
122+ Sendable :: ReverseRequest ( _) => unreachable ! ( "Reverse requests are not supported" ) ,
123123 }
124124 }
125125 } )
0 commit comments