Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
envestcc committed Aug 30, 2024
1 parent 993c38f commit 60afaf3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,18 @@ func (wsSvr *WebsocketHandler) handleConnection(ctx context.Context, ws *websock
return nil
})

ctx, ctxCancel := context.WithCancel(WithStreamContext(ctx))
ctx, cancel := context.WithCancel(WithStreamContext(ctx))
safeWs := &safeWebsocketConn{ws: ws}
go ping(ctx, safeWs, ctxCancel)
go ping(ctx, safeWs, cancel)

cancel := func() {
ctxCancel()
defer func() {
// clean up the stream context
sc, _ := StreamFromContext(ctx)
for _, id := range sc.ListenerIDs() {
wsSvr.coreService.ChainListener().RemoveResponder(id)
}
}
}()

for {
select {
case <-ctx.Done():
Expand Down

0 comments on commit 60afaf3

Please sign in to comment.