Skip to content

Commit

Permalink
Further changes for #12. Now clearing all folio/page numbers when a n…
Browse files Browse the repository at this point in the history
…ew message is received for a component which went offline.
  • Loading branch information
dsmurfin committed Feb 1, 2021
1 parent ad94c13 commit 063ffe0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/OTPKit/Components/Consumer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,12 @@ extension OTPConsumer: ComponentSocketDelegate {
if producer.notifiedState == .offline, let index = self.producers.firstIndex(where: { $0.cid == otpLayer.cid }) {
// this producer had gone offline, so start allowing messages from another IP family
self.producers[index].ipMode = newComponentIPMode

// reset folio and page numbers
self.producers[index].systemAdvertisementFolio = nil
self.producers[index].nameAdvertisementFolio = nil
self.producers[index].nameAdvertisementPage = nil
self.producers[index].systemTransformFolios = []
} else {
switch producer.ipMode {
case .ipv4Only:
Expand Down
7 changes: 7 additions & 0 deletions Sources/OTPKit/Components/Producer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,13 @@ extension OTPProducer: ComponentSocketDelegate {
if consumer.notifiedState == .offline, let index = self.consumers.firstIndex(where: { $0.cid == otpLayer.cid }) {
// this consumer had gone offline, so start allowing messages from another IP family
self.consumers[index].ipMode = newComponentIPMode

// reset folio and page numbers
self.consumers[index].systemAdvertisementFolio = nil
self.consumers[index].nameAdvertisementFolio = nil
self.consumers[index].nameAdvertisementPage = nil
self.consumers[index].moduleAdvertisementFolio = nil
self.consumers[index].moduleAdvertisementPage = nil
} else {
switch consumer.ipMode {
case .ipv4Only:
Expand Down

0 comments on commit 063ffe0

Please sign in to comment.