Use gvisor checklocks for static lock analysis.

Also fix locking issues found along the way.

See https://github.com/google/gvisor/tree/master/tools/checklocks for details.
This commit is contained in:
Joachim Bauch 2025-09-26 17:20:17 +02:00
commit cfd8cf6718
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02
61 changed files with 707 additions and 345 deletions

View file

@ -113,7 +113,7 @@ type MessagePayload struct {
}
type SignalingClient struct {
readyWg *sync.WaitGroup
readyWg *sync.WaitGroup // +checklocksignore: Only written to from constructor.
cookie *signaling.SessionIdCodec
conn *websocket.Conn
@ -123,10 +123,13 @@ type SignalingClient struct {
stopChan chan struct{}
lock sync.Mutex
lock sync.Mutex
// +checklocks:lock
privateSessionId signaling.PrivateSessionId
publicSessionId signaling.PublicSessionId
userId string
// +checklocks:lock
publicSessionId signaling.PublicSessionId
// +checklocks:lock
userId string
}
func NewSignalingClient(cookie *signaling.SessionIdCodec, url string, stats *Stats, readyWg *sync.WaitGroup, doneWg *sync.WaitGroup) (*SignalingClient, error) {