Skip to content

Commit

Permalink
document what happens to established connections on Listener.Close (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Oct 28, 2023
1 parent 6eb0cac commit a360354
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ func (l *Listener) Accept(ctx context.Context) (Connection, error) {
// Close closes the listener.
// Accept will return ErrServerClosed as soon as all connections in the accept queue have been accepted.
// QUIC handshakes that are still in flight will be rejected with a CONNECTION_REFUSED error.
// Closing the listener doesn't have any effect on already established connections.
// The effect of closing the listener depends on how it was created:
// * if it was created using Transport.Listen, already established connections will be unaffected
// * if it was created using the Listen convenience method, all established connection will be closed immediately
func (l *Listener) Close() error {
return l.baseServer.Close()
}
Expand Down Expand Up @@ -216,6 +218,7 @@ func listenUDP(addr string) (*net.UDPConn, error) {
// This is a convenience function. More advanced use cases should instantiate a Transport,
// which offers configuration options for a more fine-grained control of the connection establishment,
// including reusing the underlying UDP socket for outgoing QUIC connections.
// When closing a listener created with Listen, all established QUIC connections will be closed immediately.
func Listen(conn net.PacketConn, tlsConf *tls.Config, config *Config) (*Listener, error) {
tr := &Transport{Conn: conn, isSingleUse: true}
return tr.Listen(tlsConf, config)
Expand Down

0 comments on commit a360354

Please sign in to comment.