@@ -41,7 +41,6 @@ extension CbfClient {
41
41
let id = ObjectIdentifier ( self )
42
42
43
43
let task = Task { [ self ] in
44
- var hasEstablishedConnection = false
45
44
while true {
46
45
if Task . isCancelled { break }
47
46
do {
@@ -63,14 +62,11 @@ extension CbfClient {
63
62
object: nil ,
64
63
userInfo: [ " height " : height]
65
64
)
66
- if !hasEstablishedConnection {
67
- hasEstablishedConnection = true
68
- NotificationCenter . default. post (
69
- name: NSNotification . Name ( " KyotoConnectionUpdate " ) ,
70
- object: nil ,
71
- userInfo: [ " connected " : true ]
72
- )
73
- }
65
+ NotificationCenter . default. post (
66
+ name: NSNotification . Name ( " KyotoConnectionUpdate " ) ,
67
+ object: nil ,
68
+ userInfo: [ " connected " : true ]
69
+ )
74
70
}
75
71
case . stateUpdate( let nodeState) :
76
72
await MainActor . run {
@@ -79,17 +75,19 @@ extension CbfClient {
79
75
object: nil ,
80
76
userInfo: [ " state " : nodeState]
81
77
)
78
+ NotificationCenter . default. post (
79
+ name: NSNotification . Name ( " KyotoConnectionUpdate " ) ,
80
+ object: nil ,
81
+ userInfo: [ " connected " : true ]
82
+ )
82
83
}
83
84
case . connectionsMet, . successfulHandshake:
84
85
await MainActor . run {
85
- if !hasEstablishedConnection {
86
- hasEstablishedConnection = true
87
- NotificationCenter . default. post (
88
- name: NSNotification . Name ( " KyotoConnectionUpdate " ) ,
89
- object: nil ,
90
- userInfo: [ " connected " : true ]
91
- )
92
- }
86
+ NotificationCenter . default. post (
87
+ name: NSNotification . Name ( " KyotoConnectionUpdate " ) ,
88
+ object: nil ,
89
+ userInfo: [ " connected " : true ]
90
+ )
93
91
}
94
92
default :
95
93
break
0 commit comments