Skip to content

Commit edebe05

Browse files
author
valentin benozillo
committed
Fix: use Ipv4 by default
1 parent 6b4efa3 commit edebe05

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fluent/sender.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ def close(self):
122122
self._close()
123123
self.pendings = None
124124

125-
def _is_ipv6_host(self):
125+
def _is_ipv4_host(self):
126126
try:
127-
socket.getaddrinfo(self.host, None, socket.AF_INET6)
127+
socket.getaddrinfo(self.host, None, socket.AF_INET)
128128
return True
129129
except socket.error:
130130
return False
@@ -210,11 +210,11 @@ def _reconnect(self):
210210
sock.settimeout(self.timeout)
211211
sock.connect(self.host[len('unix://'):])
212212
else:
213-
if self._is_ipv6_host():
214-
sock = socket.socket(socket.AF_INET6,
213+
if self._is_ipv4_host():
214+
sock = socket.socket(socket.AF_INET,
215215
socket.SOCK_STREAM)
216216
else:
217-
sock = socket.socket(socket.AF_INET,
217+
sock = socket.socket(socket.AF_INET6,
218218
socket.SOCK_STREAM)
219219
sock.settimeout(self.timeout)
220220
# This might be controversial and may need to be removed

0 commit comments

Comments
 (0)