diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2014-11-29 15:30:09 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2014-11-29 15:30:09 +0000 |
commit | fe076d92eca402b27979bacf4062563e759e7279 (patch) | |
tree | acca86039c851dd4a85240c195f0e759787aecbe /plugins/Ping | |
parent | 425e0f8eb79c6779ebe40f75cce92194ed103389 (diff) |
-Fixed a bug in Ping and other small things reported in #837
git-svn-id: http://svn.miranda-ng.org/main/trunk@11151 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Ping')
-rw-r--r-- | plugins/Ping/src/rawping.cpp | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/plugins/Ping/src/rawping.cpp b/plugins/Ping/src/rawping.cpp index 007200fa23..f31868db5a 100644 --- a/plugins/Ping/src/rawping.cpp +++ b/plugins/Ping/src/rawping.cpp @@ -149,38 +149,48 @@ extern int raw_ping(char *host, int timeout) if (bread == SOCKET_ERROR) {
if(WSAGetLastError() != WSAETIMEDOUT) {
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: socket error...cycling"), 0);
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: socket error...cycling"), 0);
}
continue;
}
- if(reply_header->proto != ICMP_PROTO)
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: packet not ICMP...cycling"), 0);
+ if(reply_header->proto != ICMP_PROTO) {
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: packet not ICMP...cycling"), 0);
continue;
+ }
- if(reply_header->tos != 0)
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: TOS not 0...cycling"), 0);
+ if(reply_header->tos != 0) {
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: TOS not 0...cycling"), 0);
continue;
+ }
reply = (ICMPHeader *)(recv_buff + reply_header->h_len * 4);
if((unsigned)bread < reply_header->h_len * 4 + sizeof(ICMPHeader)) {
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: short header"), 0);
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: short header"), 0);
continue;
}
- if(reply->id != (USHORT)GetCurrentProcessId())
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong ID...cycling"), 0);
+ if(reply->id != (USHORT)GetCurrentProcessId()) {
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong ID...cycling"), 0);
continue;
+ }
if(reply->type != PT_ICMP_ECHO_REPLY && reply->type != PT_ICMP_SOURCE_QUENCH) {
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong type...cycling"), 0);
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong type...cycling"), 0);
continue;
}
//if(reply->seq < seq_no) continue;
//if(reply->seq > seq_no) return -1;
if(reply->seq != seq_no) {
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong sequence number...cycling"), 0);
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: wrong sequence number...cycling"), 0);
continue;
}
@@ -197,7 +207,8 @@ extern int raw_ping(char *host, int timeout) } else
return current_time - send_time;
}
- if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("rawping error: timeout"), 0);
+ if(options.logging)
+ CallService(PLUG "/Log", (WPARAM)_T("rawping error: timeout"), 0);
return -1;
}
|