Skip to content

Commit

Permalink
close the connection when run returns
Browse files Browse the repository at this point in the history
  • Loading branch information
sotoslammer committed Jul 10, 2020
1 parent af72dd6 commit d129136
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion graphql/handler/transport/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ func (c *wsConnection) run() {
// We create a cancellation that will shutdown the keep-alive when we leave
// this function.
ctx, cancel := context.WithCancel(c.ctx)
defer cancel()
defer func() {
cancel()
c.close(websocket.CloseAbnormalClosure, "unexpected closure")
}()

// Create a timer that will fire every interval to keep the connection alive.
if c.KeepAlivePingInterval != 0 {
Expand Down

0 comments on commit d129136

Please sign in to comment.