Skip to content

Commit cf9b082

Browse files
committed
fix: timedout status was never sent before
1 parent 17a6349 commit cf9b082

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

package/apple/ICMP/ICMP.mm

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ - (void)pingHandler:(GBPingSummary *_Nullable *_Nullable)summary error:(NSError
5555
double rtt = -99.0;
5656
double ttl = -99.0;
5757
BOOL isEnded = NO;
58-
int status = -99.0;
58+
int status = PingConst_STATUS_UNKNOWN_FAILURE;
5959

6060
if(summary != NULL && *summary != nil) {
6161
rtt = [*summary rtt] * MSEC_PER_SEC;
@@ -77,8 +77,6 @@ - (void)pingHandler:(GBPingSummary *_Nullable *_Nullable)summary error:(NSError
7777
}
7878
if([*error code] == kCFHostErrorUnknown || [*error code] == kCFHostErrorHostNotFound) {
7979
status = PingConst_STATUS_UNKNOWN_HOST;
80-
} else {
81-
status = PingConst_STATUS_UNKNOWN_FAILURE;
8280
}
8381
isEnded = YES;
8482
}
@@ -97,7 +95,12 @@ - (void)ping:(GBPing *)pinger didFailWithError:(NSError *)error {
9795
}
9896

9997
- (void)ping:(GBPing *)pinger didTimeoutWithSummary:(GBPingSummary *)summary {
100-
[self pingHandler:&summary error:NULL];
98+
self.onPing(
99+
PingConst_NO_ECHO_RTT,
100+
PingConst_NO_ECHO_TTL,
101+
PingConst_STATUS_TIMEDOUT,
102+
[summary sequenceNumber] == self->count - 1 ? YES : NO
103+
);
101104
}
102105

103106
- (void)ping:(GBPing *)pinger didSendPingWithSummary:(GBPingSummary *)summary {

package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ping-react-native",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "Ping controller for React Native app",
55
"author": "RakaDoank <rakaaudira@gmail.com> (https://github.com/RakaDoank)",
66
"license": "MIT",

0 commit comments

Comments
 (0)