Skip to content

Commit

Permalink
Update behaviour in QUIC listener handler
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Jan 5, 2024
1 parent 3dfa6d0 commit 1e9a59e
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/core/link_quic.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package core
import (
"context"
"crypto/tls"
"fmt"
"net"
"net/url"
"time"
Expand Down Expand Up @@ -77,18 +78,22 @@ func (l *linkQUIC) listen(ctx context.Context, url *url.URL, _ string) (net.List
go func() {
for {
qc, err := ql.Accept(ctx)
if err != nil {
switch err {
case context.Canceled, context.DeadlineExceeded:
ql.Close()
fallthrough
case quic.ErrServerClosed:
return
}
qs, err := qc.AcceptStream(ctx)
if err != nil {
ql.Close()
return
}
ch <- &linkQUICStream{
Connection: qc,
Stream: qs,
case nil:
qs, err := qc.AcceptStream(ctx)
if err != nil {
_ = qc.CloseWithError(1, fmt.Sprintf("stream error: %s", err))
continue
}
ch <- &linkQUICStream{
Connection: qc,
Stream: qs,
}
}
}
}()
Expand Down

0 comments on commit 1e9a59e

Please sign in to comment.