Created
March 16, 2012 18:11
-
-
Save teh/2051574 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d4e033f64f3d2dc93be7ba65875d370678287611 Mon Sep 17 00:00:00 2001 | |
From: Thomas Hunger <[email protected]> | |
Date: Fri, 16 Mar 2012 17:53:53 +0000 | |
Subject: [PATCH] Enable ipv6 | |
--- | |
desir/desir.py | 4 +++- | |
1 files changed, 3 insertions(+), 1 deletions(-) | |
diff --git a/desir/desir.py b/desir/desir.py | |
index a4f9273..dbe4d0f 100644 | |
--- a/desir/desir.py | |
+++ b/desir/desir.py | |
@@ -430,7 +430,9 @@ class Node(object): | |
def connect(self): | |
if self._sock: | |
return | |
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
+ | |
+ family, _, _, _, _ = socket.getaddrinfo(self.host, self.port)[0] | |
+ sock = socket.socket(family, socket.SOCK_STREAM) | |
try: | |
sock.connect((self.host, self.port)) | |
sock.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) | |
-- | |
1.7.2.5 |
Ah, sorry. If a hosts entry points to more than one IP getaddrinfo will return more than one result and using the first one is essentially random. The following patch prefers ipv4 over ipv6 and should fix the issue.
Thanks patched/commited/pushed
Have you got a gmail or something ? mine is on my github page
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I quickly tried it but it doenst work :(
Any idea why ? Never used IPv6 yet :) ( I am on MacOSX Lion by the way)