--- a/statsd_logger.py Mon May 04 17:37:43 2015 +0200
+++ b/statsd_logger.py Fri Jun 26 14:30:24 2015 +0200
@@ -75,8 +75,17 @@
couple (ip, port).
"""
global _bucket, _address, _socket
+ packed = None
+ for family in (socket.AF_INET6, socket.AF_INET):
+ try:
+ packed = socket.inet_pton(family, address)
+ break
+ except socket.error:
+ continue
+ if packed is None:
+ return
_bucket, _address = bucket, address
- _socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ _socket = socket.socket(family, socket.SOCK_DGRAM)
def statsd_c(context, n=1):