Skip to content

Commit

Permalink
Merge pull request #537 from ChIoT-Tech/master
Browse files Browse the repository at this point in the history
Add warning to Disconnect function
  • Loading branch information
MattBrittan committed Sep 16, 2021
2 parents 21ffd91 + 35c6738 commit 3f47407
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client.go
Expand Up @@ -439,6 +439,9 @@ func (c *client) attemptConnection() (net.Conn, byte, bool, error) {
// Disconnect will end the connection with the server, but not before waiting
// the specified number of milliseconds to wait for existing work to be
// completed.
// WARNING: `Disconnect` may return before all activities (goroutines) have completed. This means that
// reusing the `client` may lead to panics. If you want to reconnect when the connection drops then use
// `SetAutoReconnect` and/or `SetConnectRetry`options instead of implementing this yourself.
func (c *client) Disconnect(quiesce uint) {
status := atomic.LoadUint32(&c.status)
if status == connected {
Expand Down

0 comments on commit 3f47407

Please sign in to comment.