Skip to content
Snippets Groups Projects
Commit 2a25f330 authored by Muxi Yan's avatar Muxi Yan
Browse files

Use nil function instead of empty function

parent 61274cac
No related branches found
No related tags found
No related merge requests found
...@@ -407,8 +407,7 @@ static NSMutableDictionary *callFlags; ...@@ -407,8 +407,7 @@ static NSMutableDictionary *callFlags;
} }
}; };
[_connectivityMonitor handleLossWithHandler:handler [_connectivityMonitor handleLossWithHandler:handler
wifiStatusChangeHandler:^{ wifiStatusChangeHandler:nil];
}];
} }
- (void)setState:(GRXWriterState)newState { - (void)setState:(GRXWriterState)newState {
......
...@@ -72,6 +72,6 @@ ...@@ -72,6 +72,6 @@
* Only one handler is active at a time, so if this method is called again before the previous * Only one handler is active at a time, so if this method is called again before the previous
* handler has been called, it might never be called at all (or yes, if it has already been queued). * handler has been called, it might never be called at all (or yes, if it has already been queued).
*/ */
- (void)handleLossWithHandler:(nonnull void (^)())handler - (void)handleLossWithHandler:(void (^)())lossHandler
wifiStatusChangeHandler:(nonnull void (^)())wifiStatusChangeHandler; wifiStatusChangeHandler:(void (^)())wifiStatusChangeHandler;
@end @end
...@@ -151,14 +151,14 @@ static void PassFlagsToContextInfoBlock(SCNetworkReachabilityRef target, ...@@ -151,14 +151,14 @@ static void PassFlagsToContextInfoBlock(SCNetworkReachabilityRef target,
return returnValue; return returnValue;
} }
- (void)handleLossWithHandler:(void (^)())handler - (void)handleLossWithHandler:(void (^)())lossHandler
wifiStatusChangeHandler:(nonnull void (^)())wifiStatusChangeHandler { wifiStatusChangeHandler:(void (^)())wifiStatusChangeHandler {
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
[self startListeningWithHandler:^(GRPCReachabilityFlags *flags) { [self startListeningWithHandler:^(GRPCReachabilityFlags *flags) {
typeof(self) strongSelf = weakSelf; typeof(self) strongSelf = weakSelf;
if (strongSelf) { if (strongSelf) {
if (!flags.reachable) { if (!flags.reachable) {
handler(); lossHandler();
} else if (strongSelf->_previousReachabilityFlags && } else if (strongSelf->_previousReachabilityFlags &&
(flags.isWWAN ^ (flags.isWWAN ^
strongSelf->_previousReachabilityFlags.isWWAN)) { strongSelf->_previousReachabilityFlags.isWWAN)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment