Permalink
Browse files

Merge pull request #313 from alex88/patch-1

Use getaddrinfo to get ipv6 working
  • Loading branch information...
2 parents 59217b0 + 210aa64 commit 87e0948384a7d8a1e5bc875b74066853e5f267b4 Gavin M. Roy committed Mar 28, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 pika/adapters/base_connection.py
View
4 pika/adapters/base_connection.py
@@ -162,7 +162,9 @@ def _check_state_on_disconnect(self):
def _create_and_connect_to_socket(self):
"""Create socket and connect to it, using SSL if enabled."""
LOGGER.debug('Creating the socket')
- self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
+ conn_info = socket.getaddrinfo(self.params.host, self.params.port,
+ 0, 0, socket.getprotobyname("tcp"))[0]
+ self.socket = socket.socket(conn_info[0], socket.SOCK_STREAM, 0)
#self.socket.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1)
if self.params.ssl:
self.socket = self._wrap_socket(self.socket)

0 comments on commit 87e0948

Please sign in to comment.