Skip to content
This repository was archived by the owner on Apr 18, 2018. It is now read-only.
This repository was archived by the owner on Apr 18, 2018. It is now read-only.

ipv6 support #78

@jsn

Description

@jsn

The module doesn't work with ipv6. I didn't try workers, but with clients, there are (at least) two issues.
Firstly, server endpoint parsing code uses hostport_tuple.split(':'), which is bad for ipv6 (since ipv6 addresses contain a lot of ':').
Secondly, what's worse, it uses an explicit AF_INET for connect(), which restricts it to IPv4 addresses. Is there a reason for that?

The following patch fixes the second issue and allows the client code to work at least when the server address is specified as a name or as a tuple of (ipv6_addr, port):

--- connection.py.old       2015-06-13 16:46:27.000000000 +0300
+++ connection.py       2015-06-15 13:41:18.976557457 +0300
@@ -94,8 +94,8 @@
     def _create_client_socket(self):
         """Creates a client side socket and subsequently binds/configures our socket options"""
         try:
-            client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-            client_socket.connect((self.gearman_host, self.gearman_port))
+            client_socket = socket.create_connection(
+                    (self.gearman_host, self.gearman_port))
         except socket.error, socket_exception:
             self.throw_exception(exception=socket_exception)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions