eclipse-paho / paho.mqtt.golang

Other
2.77k stars 534 forks source link

fix: issue 675:goroutine leak when connectionUp(true) return error #677

Closed kiqi007 closed 5 months ago

kiqi007 commented 5 months ago

bug: https://github.com/eclipse/paho.mqtt.golang/issues/675

fix: ··· if err := connectionUp(true); err != nil { ERROR.Println(CLI, err)

    /* issue 675:goroutine leak when connectionUp(true) return error
     *   Only when status == disconnecting will this logic be executed.
     * The goroutine that changes the status to disconnecting should be
     * responsible for resource cleanup (which is indeed how it is done).
     *
     *   Being disconnected right when the connection is established is a special case.
     * Even if we remove this check for connectionUp(true), the program must still function correctly,
     * as if a Disconnect event occurred immediately after connectionUp(true) completed.
     */

    //close(c.stop) // Tidy up anything we have already started
    //close(incomingPubChan)
    //c.workers.Wait()
    //c.conn.Close()
    //c.conn = nil
}

···