Skip to content

Commit

Permalink
Merge pull request #1248 from sotoslammer/master
Browse files Browse the repository at this point in the history
close the connection when run returns
  • Loading branch information
lwc committed Jul 14, 2020
2 parents d7eabaf + cc9c520 commit 0fbf293
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 0fbf293

Please sign in to comment.