Skip to content

Commit a4a04bf

Browse files
committed
Include self when notifying disconnected
1 parent 03ca767 commit a4a04bf

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Sources/OTPKit/Components/Consumer.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ extension OTPConsumer: ComponentSocketDelegate {
16091609
func socketDidClose(_ socket: ComponentSocket, withError error: Error?) {
16101610
if self._isConnected != false {
16111611
self._isConnected = false
1612-
delegateQueue.async { self.consumerDelegate?.disconnected(with: error) }
1612+
delegateQueue.async { self.consumerDelegate?.disconnected(self, with: error) }
16131613
}
16141614
}
16151615

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

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

16831684
*/
1684-
func disconnected(with error: Error?)
1685+
func disconnected(_ consumer: OTPConsumer, with error: Error?)
16851686

16861687
}
16871688

Sources/OTPKit/Components/Producer.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,7 @@ extension OTPProducer: ComponentSocketDelegate {
18851885
func socketDidClose(_ socket: ComponentSocket, withError error: Error?) {
18861886
if self._isConnected != false {
18871887
self._isConnected = false
1888-
delegateQueue.async { self.producerDelegate?.disconnected(with: error) }
1888+
delegateQueue.async { self.producerDelegate?.disconnected(self, with: error) }
18891889
}
18901890
}
18911891

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

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

19321933
*/
1933-
func disconnected(with error: Error?)
1934+
func disconnected(_ producer: OTPProducer, with error: Error?)
19341935

19351936
}
19361937

0 commit comments

Comments
 (0)