File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,11 @@ func (q *QUICConnection) serveControlStream(ctx context.Context, controlStream q
122122 return nil
123123}
124124
125+ // Close closes the session with no errors specified.
126+ func (q * QUICConnection ) Close () {
127+ q .session .CloseWithError (0 , "" )
128+ }
129+
125130func (q * QUICConnection ) acceptStream (ctx context.Context ) error {
126131 defer q .Close ()
127132 for {
@@ -133,20 +138,17 @@ func (q *QUICConnection) acceptStream(ctx context.Context) error {
133138 }
134139 return fmt .Errorf ("failed to accept QUIC stream: %w" , err )
135140 }
136- go func () {
137- stream := quicpogs .NewSafeStreamCloser (quicStream )
138- defer stream .Close ()
139-
140- if err = q .handleStream (stream ); err != nil {
141- q .logger .Err (err ).Msg ("Failed to handle QUIC stream" )
142- }
143- }()
141+ go q .runStream (quicStream )
144142 }
145143}
146144
147- // Close closes the session with no errors specified.
148- func (q * QUICConnection ) Close () {
149- q .session .CloseWithError (0 , "" )
145+ func (q * QUICConnection ) runStream (quicStream quic.Stream ) {
146+ stream := quicpogs .NewSafeStreamCloser (quicStream )
147+ defer stream .Close ()
148+
149+ if err := q .handleStream (stream ); err != nil {
150+ q .logger .Err (err ).Msg ("Failed to handle QUIC stream" )
151+ }
150152}
151153
152154func (q * QUICConnection ) handleStream (stream io.ReadWriteCloser ) error {
You can’t perform that action at this time.
0 commit comments