Skip to content

Commit 063ffe0

Browse files
committed
Further changes for #12. Now clearing all folio/page numbers when a new message is received for a component which went offline.
1 parent ad94c13 commit 063ffe0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Sources/OTPKit/Components/Consumer.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,12 @@ extension OTPConsumer: ComponentSocketDelegate {
12181218
if producer.notifiedState == .offline, let index = self.producers.firstIndex(where: { $0.cid == otpLayer.cid }) {
12191219
// this producer had gone offline, so start allowing messages from another IP family
12201220
self.producers[index].ipMode = newComponentIPMode
1221+
1222+
// reset folio and page numbers
1223+
self.producers[index].systemAdvertisementFolio = nil
1224+
self.producers[index].nameAdvertisementFolio = nil
1225+
self.producers[index].nameAdvertisementPage = nil
1226+
self.producers[index].systemTransformFolios = []
12211227
} else {
12221228
switch producer.ipMode {
12231229
case .ipv4Only:

Sources/OTPKit/Components/Producer.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,13 @@ extension OTPProducer: ComponentSocketDelegate {
14171417
if consumer.notifiedState == .offline, let index = self.consumers.firstIndex(where: { $0.cid == otpLayer.cid }) {
14181418
// this consumer had gone offline, so start allowing messages from another IP family
14191419
self.consumers[index].ipMode = newComponentIPMode
1420+
1421+
// reset folio and page numbers
1422+
self.consumers[index].systemAdvertisementFolio = nil
1423+
self.consumers[index].nameAdvertisementFolio = nil
1424+
self.consumers[index].nameAdvertisementPage = nil
1425+
self.consumers[index].moduleAdvertisementFolio = nil
1426+
self.consumers[index].moduleAdvertisementPage = nil
14201427
} else {
14211428
switch consumer.ipMode {
14221429
case .ipv4Only:

0 commit comments

Comments
 (0)