Skip to content

Commit

Permalink
QUICServer struct docs
Browse files Browse the repository at this point in the history
  • Loading branch information
espadolini committed Oct 17, 2024
1 parent 1cb25d5 commit e9ea132
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/proxy/peer/quicserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ type QUICServer struct {
tlsConfig *tls.Config
quicConfig *quic.Config

mu sync.Mutex
closed bool
wg sync.WaitGroup

replayStore replayStore

// runCtx is a context that gets canceled when all connections should be
Expand All @@ -113,6 +109,16 @@ type QUICServer struct {
serveCtx context.Context
// serveCancel cancels serveCtx.
serveCancel context.CancelFunc

// mu protects everything further in the struct.
mu sync.Mutex
// closed is set at the beginning of shutdown. When set, nothing is allowed
// to increase the waitgroup count past 0.
closed bool
// wg counts any active listener and connection. Should only be increased
// from 0 while holding mu, if the closed flag is not set. Should only be
// waited after setting the closed flag.
wg sync.WaitGroup
}

// NewQUICServer returns a [QUICServer] with the given config.
Expand Down

0 comments on commit e9ea132

Please sign in to comment.