File tree Expand file tree Collapse file tree 8 files changed +26
-50
lines changed
Expand file tree Collapse file tree 8 files changed +26
-50
lines changed Original file line number Diff line number Diff line change @@ -1107,10 +1107,7 @@ impl TransportManager {
11071107 "connection accepted and protocols notified" ,
11081108 ) ;
11091109
1110- return Some ( TransportEvent :: ConnectionEstablished {
1111- peer,
1112- endpoint,
1113- } ) ;
1110+ return Some ( TransportEvent :: ConnectionEstablished { peer, endpoint } ) ;
11141111 }
11151112 Err ( error) => {
11161113 tracing:: debug!(
Original file line number Diff line number Diff line change @@ -199,7 +199,10 @@ pub(crate) trait Transport: Stream + Unpin + Send {
199199 /// and all installed protocols have been notified via their event channels.
200200 /// This ensures that by the time the caller receives a ConnectionEstablished event,
201201 /// protocols are ready to handle substream operations.
202- fn accept ( & mut self , connection_id : ConnectionId ) -> crate :: Result < BoxFuture < ' static , crate :: Result < ( ) > > > ;
202+ fn accept (
203+ & mut self ,
204+ connection_id : ConnectionId ,
205+ ) -> crate :: Result < BoxFuture < ' static , crate :: Result < ( ) > > > ;
203206
204207 /// Accept pending connection.
205208 fn accept_pending ( & mut self , connection_id : ConnectionId ) -> crate :: Result < ( ) > ;
Original file line number Diff line number Diff line change @@ -231,18 +231,9 @@ impl QuicConnection {
231231 } )
232232 }
233233
234- /// Start event loop for [`QuicConnection`].
235- pub async fn start ( mut self ) -> crate :: Result < ( ) > {
236- self . protocol_set
237- . report_connection_established ( self . peer , self . endpoint . clone ( ) )
238- . await ?;
239-
240- self . start_event_loop ( ) . await
241- }
242-
243234 /// Start the connection event loop without notifying protocols.
244235 /// This is used when protocols have already been notified during accept().
245- pub ( crate ) async fn start_event_loop ( mut self ) -> crate :: Result < ( ) > {
236+ pub ( crate ) async fn start ( mut self ) -> crate :: Result < ( ) > {
246237 loop {
247238 tokio:: select! {
248239 event = self . connection. accept_bi( ) => match event {
Original file line number Diff line number Diff line change @@ -306,7 +306,10 @@ impl Transport for QuicTransport {
306306 Ok ( ( ) )
307307 }
308308
309- fn accept ( & mut self , connection_id : ConnectionId ) -> crate :: Result < BoxFuture < ' static , crate :: Result < ( ) > > > {
309+ fn accept (
310+ & mut self ,
311+ connection_id : ConnectionId ,
312+ ) -> crate :: Result < BoxFuture < ' static , crate :: Result < ( ) > > > {
310313 let ( connection, endpoint) = self
311314 . pending_open
312315 . remove ( & connection_id)
@@ -327,9 +330,7 @@ impl Transport for QuicTransport {
327330
328331 Ok ( Box :: pin ( async move {
329332 // First, notify all protocols about the connection establishment
330- protocol_set
331- . report_connection_established ( peer, endpoint_clone)
332- . await ?;
333+ protocol_set. report_connection_established ( peer, endpoint_clone) . await ?;
333334
334335 // After protocols are notified, spawn the connection event loop
335336 executor. run ( Box :: pin ( async move {
@@ -341,7 +342,7 @@ impl Transport for QuicTransport {
341342 bandwidth_sink,
342343 substream_open_timeout,
343344 )
344- . start_event_loop ( )
345+ . start ( )
345346 . await ;
346347 } ) ) ;
347348
Original file line number Diff line number Diff line change @@ -730,18 +730,9 @@ impl TcpConnection {
730730 }
731731 }
732732
733- /// Start connection event loop.
734- pub ( crate ) async fn start ( mut self ) -> crate :: Result < ( ) > {
735- self . protocol_set
736- . report_connection_established ( self . peer , self . endpoint . clone ( ) )
737- . await ?;
738-
739- self . start_event_loop ( ) . await
740- }
741-
742733 /// Start the connection event loop without notifying protocols.
743734 /// This is used when protocols have already been notified during accept().
744- pub ( crate ) async fn start_event_loop ( mut self ) -> crate :: Result < ( ) > {
735+ pub ( crate ) async fn start ( mut self ) -> crate :: Result < ( ) > {
745736 loop {
746737 tokio:: select! {
747738 substream = self . connection. next( ) => {
Original file line number Diff line number Diff line change @@ -389,7 +389,10 @@ impl Transport for TcpTransport {
389389 )
390390 }
391391
392- fn accept ( & mut self , connection_id : ConnectionId ) -> crate :: Result < BoxFuture < ' static , crate :: Result < ( ) > > > {
392+ fn accept (
393+ & mut self ,
394+ connection_id : ConnectionId ,
395+ ) -> crate :: Result < BoxFuture < ' static , crate :: Result < ( ) > > > {
393396 let context = self
394397 . pending_open
395398 . remove ( & connection_id)
@@ -411,15 +414,13 @@ impl Transport for TcpTransport {
411414 Ok ( Box :: pin ( async move {
412415 // First, notify all protocols about the connection establishment
413416 // This ensures that when the accept() future completes, protocols are ready
414- protocol_set
415- . report_connection_established ( peer, endpoint)
416- . await ?;
417+ protocol_set. report_connection_established ( peer, endpoint) . await ?;
417418
418419 // After protocols are notified, spawn the connection event loop
419420 executor. run ( Box :: pin ( async move {
420421 if let Err ( error) =
421422 TcpConnection :: new ( context, protocol_set, bandwidth_sink, next_substream_id)
422- . start_event_loop ( )
423+ . start ( )
423424 . await
424425 {
425426 tracing:: debug!(
Original file line number Diff line number Diff line change @@ -453,18 +453,9 @@ impl WebSocketConnection {
453453 } )
454454 }
455455
456- /// Start connection event loop.
457- pub ( crate ) async fn start ( mut self ) -> crate :: Result < ( ) > {
458- self . protocol_set
459- . report_connection_established ( self . peer , self . endpoint . clone ( ) )
460- . await ?;
461-
462- self . start_event_loop ( ) . await
463- }
464-
465456 /// Start the connection event loop without notifying protocols.
466457 /// This is used when protocols have already been notified during accept().
467- pub ( crate ) async fn start_event_loop ( mut self ) -> crate :: Result < ( ) > {
458+ pub ( crate ) async fn start ( mut self ) -> crate :: Result < ( ) > {
468459 loop {
469460 tokio:: select! {
470461 substream = self . connection. next( ) => match substream {
Original file line number Diff line number Diff line change @@ -398,7 +398,10 @@ impl Transport for WebSocketTransport {
398398 Ok ( ( ) )
399399 }
400400
401- fn accept ( & mut self , connection_id : ConnectionId ) -> crate :: Result < BoxFuture < ' static , crate :: Result < ( ) > > > {
401+ fn accept (
402+ & mut self ,
403+ connection_id : ConnectionId ,
404+ ) -> crate :: Result < BoxFuture < ' static , crate :: Result < ( ) > > > {
402405 let context = self
403406 . pending_open
404407 . remove ( & connection_id)
@@ -419,9 +422,7 @@ impl Transport for WebSocketTransport {
419422
420423 Ok ( Box :: pin ( async move {
421424 // First, notify all protocols about the connection establishment
422- protocol_set
423- . report_connection_established ( peer, endpoint)
424- . await ?;
425+ protocol_set. report_connection_established ( peer, endpoint) . await ?;
425426
426427 // After protocols are notified, spawn the connection event loop
427428 executor. run ( Box :: pin ( async move {
@@ -431,7 +432,7 @@ impl Transport for WebSocketTransport {
431432 bandwidth_sink,
432433 substream_open_timeout,
433434 )
434- . start_event_loop ( )
435+ . start ( )
435436 . await
436437 {
437438 tracing:: debug!(
You can’t perform that action at this time.
0 commit comments