Skip to content

Commit

Permalink
Fix listen example error handling
Browse files Browse the repository at this point in the history
Don't call hub.Register if Accept returned error.
  • Loading branch information
at-wat committed Mar 23, 2020
1 parent 8d11fee commit 3f3108d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion examples/listen-psk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ func main() {
// functions like `RemoteCertificate` etc.

// Register the connection with the chat hub
hub.Register(conn)
if err == nil {
hub.Register(conn)
}
}
}()

Expand Down
4 changes: 3 additions & 1 deletion examples/listen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ func main() {
// functions like `RemoteCertificate` etc.

// Register the connection with the chat hub
hub.Register(conn)
if err == nil {
hub.Register(conn)
}
}
}()

Expand Down

0 comments on commit 3f3108d

Please sign in to comment.