File tree 1 file changed +16
-9
lines changed
src/darwin/Framework/CHIP
1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -148,19 +148,26 @@ - (void)handleResolvedHostname:(const char *)hostName port:(uint16_t)port error:
148
148
return ;
149
149
}
150
150
nw_connection_set_queue (connection, sSharedResolverQueue );
151
+ mtr_weakify (self);
151
152
nw_connection_set_path_changed_handler (connection, ^(nw_path_t _Nonnull path) {
152
- nw_path_status_t status = nw_path_get_status (path);
153
- if (status == nw_path_status_satisfied) {
154
- MTR_LOG_INFO (" %@ path is satisfied" , self);
155
- std::lock_guard lock (sConnectivityMonitorLock );
156
- [self _callHandler ];
153
+ mtr_strongify (self);
154
+ if (self) {
155
+ nw_path_status_t status = nw_path_get_status (path);
156
+ if (status == nw_path_status_satisfied) {
157
+ MTR_LOG_INFO (" %@ path is satisfied" , self);
158
+ std::lock_guard lock (sConnectivityMonitorLock );
159
+ [self _callHandler ];
160
+ }
157
161
}
158
162
});
159
163
nw_connection_set_viability_changed_handler (connection, ^(bool viable) {
160
- if (viable) {
161
- std::lock_guard lock (sConnectivityMonitorLock );
162
- MTR_LOG_INFO (" %@ connectivity now viable" , self);
163
- [self _callHandler ];
164
+ mtr_strongify (self);
165
+ if (self) {
166
+ if (viable) {
167
+ std::lock_guard lock (sConnectivityMonitorLock );
168
+ MTR_LOG_INFO (" %@ connectivity now viable" , self);
169
+ [self _callHandler ];
170
+ }
164
171
}
165
172
});
166
173
nw_connection_start (connection);
You can’t perform that action at this time.
0 commit comments