File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -247,8 +247,12 @@ func (s *Server) update() {
247
247
checkNow := s .checkNow
248
248
done := s .done
249
249
250
+ var doneOnce bool
250
251
defer func () {
251
252
if r := recover (); r != nil {
253
+ if doneOnce {
254
+ return
255
+ }
252
256
// We keep this goroutine alive attempting to read from the done channel.
253
257
<- done
254
258
}
@@ -261,13 +265,17 @@ func (s *Server) update() {
261
265
s .updateDescription (desc , true )
262
266
263
267
closeServer := func () {
268
+ doneOnce = true
264
269
s .subLock .Lock ()
265
270
for id , c := range s .subscribers {
266
271
close (c )
267
272
delete (s .subscribers , id )
268
273
}
269
274
s .subscriptionsClosed = true
270
275
s .subLock .Unlock ()
276
+ if conn == nil {
277
+ return
278
+ }
271
279
conn .Close ()
272
280
}
273
281
for {
You can’t perform that action at this time.
0 commit comments