fix: avoid agent runLoop exiting due to ws ping (#8852)

This commit is contained in:
Dean Sheather
2023-08-02 07:25:07 +00:00
committed by GitHub
parent f48e8dcf88
commit b955c5fefc
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -204,7 +204,7 @@ func (c *Client) DERPMapUpdates(ctx context.Context) (<-chan DERPMapUpdate, io.C
defer close(updates)
defer close(updatesClosed)
defer cancelFunc()
defer conn.Close(websocket.StatusGoingAway, "Listen closed")
defer conn.Close(websocket.StatusGoingAway, "DERPMapUpdates closed")
for {
var update DERPMapUpdate
err := dec.Decode(&update.DERPMap)
@@ -240,7 +240,7 @@ func (c *Client) DERPMapUpdates(ctx context.Context) (<-chan DERPMapUpdate, io.C
closeFunc: func() error {
cancelFunc()
<-pingClosed
_ = conn.Close(websocket.StatusGoingAway, "Listen closed")
_ = conn.Close(websocket.StatusGoingAway, "DERPMapUpdates closed")
<-updatesClosed
return nil
},