File tree 3 files changed +14
-8
lines changed
3 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -138,9 +138,9 @@ jobs:
138
138
~/.cache/go-build
139
139
~/Library/Caches/go-build
140
140
%LocalAppData%\go-build
141
- key : ${{ runner .os }}-go-${{ hashFiles('**/go.sum') }}
141
+ key : ${{ matrix .os }}-go-${{ hashFiles('**/go.sum') }}
142
142
restore-keys : |
143
- ${{ runner .os }}-go-
143
+ ${{ matrix .os }}-go-
144
144
145
145
- run : go install gotest.tools/gotestsum@latest
146
146
Original file line number Diff line number Diff line change @@ -183,12 +183,15 @@ func (c *Conn) init() error {
183
183
}
184
184
})
185
185
c .rtc .OnConnectionStateChange (func (peerConnectionState webrtc.PeerConnectionState ) {
186
- if c .isClosed () {
187
- // Make sure we don't log after Close() has been called.
188
- return
189
- }
190
- c .opts .Logger .Debug (context .Background (), "rtc connection updated" ,
191
- slog .F ("state" , peerConnectionState ))
186
+ go func () {
187
+ c .closeMutex .Lock ()
188
+ defer c .closeMutex .Unlock ()
189
+ if c .isClosed () {
190
+ return
191
+ }
192
+ c .opts .Logger .Debug (context .Background (), "rtc connection updated" ,
193
+ slog .F ("state" , peerConnectionState ))
194
+ }()
192
195
193
196
switch peerConnectionState {
194
197
case webrtc .PeerConnectionStateDisconnected :
Original file line number Diff line number Diff line change @@ -110,10 +110,13 @@ func (p *provisionerDaemon) connect(ctx context.Context) {
110
110
if errors .Is (err , context .Canceled ) {
111
111
return
112
112
}
113
+ p .closeMutex .Lock ()
113
114
if p .isClosed () {
115
+ p .closeMutex .Unlock ()
114
116
return
115
117
}
116
118
p .opts .Logger .Warn (context .Background (), "failed to dial" , slog .Error (err ))
119
+ p .closeMutex .Unlock ()
117
120
continue
118
121
}
119
122
p .opts .Logger .Debug (context .Background (), "connected" )
You can’t perform that action at this time.
0 commit comments