Skip to content

Commit

Permalink
Use nil function instead of empty function
Browse files Browse the repository at this point in the history
  • Loading branch information
Muxi Yan committed Oct 28, 2016
1 parent 61274ca commit 2a25f33
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/objective-c/GRPCClient/GRPCCall.m
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,7 @@ - (void)startWithWriteable:(id<GRXWriteable>)writeable {
}
};
[_connectivityMonitor handleLossWithHandler:handler
wifiStatusChangeHandler:^{
}];
wifiStatusChangeHandler:nil];
}

- (void)setState:(GRXWriterState)newState {
Expand Down
4 changes: 2 additions & 2 deletions src/objective-c/GRPCClient/private/GRPCConnectivityMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@
* 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).
*/
- (void)handleLossWithHandler:(nonnull void (^)())handler
wifiStatusChangeHandler:(nonnull void (^)())wifiStatusChangeHandler;
- (void)handleLossWithHandler:(void (^)())lossHandler
wifiStatusChangeHandler:(void (^)())wifiStatusChangeHandler;
@end
6 changes: 3 additions & 3 deletions src/objective-c/GRPCClient/private/GRPCConnectivityMonitor.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ + (nullable instancetype)monitorWithHost:(nonnull NSString *)host {
return returnValue;
}

- (void)handleLossWithHandler:(void (^)())handler
wifiStatusChangeHandler:(nonnull void (^)())wifiStatusChangeHandler {
- (void)handleLossWithHandler:(void (^)())lossHandler
wifiStatusChangeHandler:(void (^)())wifiStatusChangeHandler {
__weak typeof(self) weakSelf = self;
[self startListeningWithHandler:^(GRPCReachabilityFlags *flags) {
typeof(self) strongSelf = weakSelf;
if (strongSelf) {
if (!flags.reachable) {
handler();
lossHandler();
} else if (strongSelf->_previousReachabilityFlags &&
(flags.isWWAN ^
strongSelf->_previousReachabilityFlags.isWWAN)) {
Expand Down

0 comments on commit 2a25f33

Please sign in to comment.