On one hand, since the address of destination in request has been resolved before sock.send in ping and traceroute, call socket.getaddrinfo before sendto seems redundant.
On the other hand, socket.getaddrinfo before python 3.9 (including 3.9) will ACQUIRE_GETADDRINFO_LOCK (https://github.com/python/cpython/blob/3.9/Modules/socketmodule.c#L1193). So getaddrinfo may be locked.
When user uses multi-threading with icmplib and other network functions, ping provided by icmplib may be blocked by other getaddrinfo's timeout.
On one hand, since the address of destination in request has been resolved before sock.send in
ping
andtraceroute
, call socket.getaddrinfo beforesendto
seems redundant.On the other hand, socket.getaddrinfo before python 3.9 (including 3.9) will
ACQUIRE_GETADDRINFO_LOCK
(https://github.com/python/cpython/blob/3.9/Modules/socketmodule.c#L1193). Sogetaddrinfo
may be locked. When user uses multi-threading with icmplib and other network functions,ping
provided by icmplib may be blocked by other getaddrinfo's timeout.