Skip to content

Commit

Permalink
simplify reconnect code
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed May 21, 2022
1 parent ad4513a commit b8ab343
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lavalink/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,8 @@ loop:
}
_, data, err := n.conn.ReadMessage()
if err != nil {
reconnect := true
if errors.Is(err, net.ErrClosed) {
// we closed the connection manually, so we don't want to reconnect
reconnect = false
}
n.Close()
if reconnect {
if !errors.Is(err, net.ErrClosed) {
go n.reconnect(context.TODO())
}
break loop
Expand Down

0 comments on commit b8ab343

Please sign in to comment.