Skip to content

Commit

Permalink
Include self when notifying disconnected
Browse files Browse the repository at this point in the history
  • Loading branch information
dsmurfin committed Nov 7, 2022
1 parent 03ca767 commit a4a04bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Sources/OTPKit/Components/Consumer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ extension OTPConsumer: ComponentSocketDelegate {
func socketDidClose(_ socket: ComponentSocket, withError error: Error?) {
if self._isConnected != false {
self._isConnected = false
delegateQueue.async { self.consumerDelegate?.disconnected(with: error) }
delegateQueue.async { self.consumerDelegate?.disconnected(self, with: error) }
}
}

Expand Down Expand Up @@ -1678,10 +1678,11 @@ public protocol OTPConsumerDelegate: AnyObject {
Notifies the delegate that the consumer was disconnected

- Parameters:
- consumer: The consumer which was disconnected.
- error: An optional error that may have occured, for example if the network interface was removed.

*/
func disconnected(with error: Error?)
func disconnected(_ consumer: OTPConsumer, with error: Error?)

}

Expand Down
5 changes: 3 additions & 2 deletions Sources/OTPKit/Components/Producer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,7 @@ extension OTPProducer: ComponentSocketDelegate {
func socketDidClose(_ socket: ComponentSocket, withError error: Error?) {
if self._isConnected != false {
self._isConnected = false
delegateQueue.async { self.producerDelegate?.disconnected(with: error) }
delegateQueue.async { self.producerDelegate?.disconnected(self, with: error) }
}
}

Expand Down Expand Up @@ -1927,10 +1927,11 @@ public protocol OTPProducerDelegate: AnyObject {
Notifies the delegate that the producer was disconnected

- Parameters:
- producer: The producer which was disconnected.
- error: An optional error that may have occured, for example if the network interface was removed.

*/
func disconnected(with error: Error?)
func disconnected(_ producer: OTPProducer, with error: Error?)

}

Expand Down

0 comments on commit a4a04bf

Please sign in to comment.