Skip to content

Commit

Permalink
fix: auto reconnection not working
Browse files Browse the repository at this point in the history
  • Loading branch information
kisu-park authored and leeway1208 committed Jan 7, 2023
1 parent cbef88e commit 23767a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Source/CocoaMQTT.swift
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ public class CocoaMQTT: NSObject, CocoaMQTTClient {
/// disconnect expectedly
public func disconnect() {
internal_disconnect()
is_internal_disconnected = false
}

/// Disconnect unexpectedly
Expand Down Expand Up @@ -598,7 +597,7 @@ extension CocoaMQTT: CocoaMQTTSocketDelegate {
delegate?.mqttDidDisconnect(self, withError: err)
didDisconnect(self, err)

guard is_internal_disconnected else {
guard !is_internal_disconnected else {
return
}

Expand Down
4 changes: 1 addition & 3 deletions Source/CocoaMQTT5.swift
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,10 @@ public class CocoaMQTT5: NSObject, CocoaMQTT5Client {
/// disconnect expectedly
public func disconnect() {
internal_disconnect()
is_internal_disconnected = false
}

public func disconnect(reasonCode : CocoaMQTTDISCONNECTReasonCode,userProperties : [String: String] ) {
internal_disconnect_withProperties(reasonCode: reasonCode,userProperties: userProperties)
is_internal_disconnected = false
}

/// Disconnect unexpectedly
Expand Down Expand Up @@ -644,7 +642,7 @@ extension CocoaMQTT5: CocoaMQTTSocketDelegate {
delegate?.mqtt5DidDisconnect(self, withError: err)
didDisconnect(self, err)

guard is_internal_disconnected else {
guard !is_internal_disconnected else {
return
}

Expand Down

0 comments on commit 23767a4

Please sign in to comment.