Skip to content

Commit

Permalink
adjusted import syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Mazzucco committed Oct 11, 2024
1 parent b5c36f1 commit 39bc8ee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions locust/rpc/zmqrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from locust.util.exception_handler import retry

import socket as csocket
from socket import gaierror, has_dualstack_ipv6

import msgpack.exceptions as msgerr
import zmq.error as zmqerr
Expand All @@ -17,7 +18,7 @@ def __init__(self, sock_type, ipv4_only):

self.socket.setsockopt(zmq.TCP_KEEPALIVE, 1)
self.socket.setsockopt(zmq.TCP_KEEPALIVE_IDLE, 30)
if csocket.has_dualstack_ipv6() and not ipv4_only:
if has_dualstack_ipv6() and not ipv4_only:
self.socket.setsockopt(zmq.IPV6, 1)

@retry()
Expand Down Expand Up @@ -65,7 +66,7 @@ def ipv4_only(self, host, port) -> bool:
try:
if str(csocket.getaddrinfo(host, port, proto=csocket.IPPROTO_TCP)).find("Family.AF_INET6") == -1:
return True
except csocket.gaierror as e:
except gaierror as e:
print(f"Error resolving address: {e}")
return False
return False
Expand Down

0 comments on commit 39bc8ee

Please sign in to comment.