romana / multi-ping

Python library to monitor one or many IP addresses via ICMP echo (ping) requests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

multi_ping retry not working correctly

BriceSchaffner opened this issue · comments

When a request times out, a retry is correctly sent with a new ID but the receive function always looks for the old ID. This result by sending as many retry as specified in the multi_ping function and returning a failed ping as soon as at least one packet loss occurred, even if the first retry was successful.

Fwiw, I just hit this bug and fixed it before finding this thread.

I eliminated _remaining_ids and replaced it with _remaining_addrs, which resulted in notably simpler code overall (net reduction in lines of code, and I think the logic is more clear this way). It fixes the bug mentioned above, in a way that continues to listen for replies to any of the pings sent by a host and registers the first one received. The changes are very simple and clear, so easy to visually vet.

I can provide the changes if anyone is interested, but if you need to me submit them formally you'll have to hold my hand through the process.