Module: deluge
Branch: master
Commit: 71183f6c1904322c117ae4af17f96aa25b67e73c

Author: Calum Lind <calumlind+del...@gmail.com>
Date:   Sat Dec  1 02:21:01 2012 +0000

Add windows support to is_ip

---

 deluge/common.py |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/deluge/common.py b/deluge/common.py
index cde0d3c..dd0a86e 100644
--- a/deluge/common.py
+++ b/deluge/common.py
@@ -544,15 +544,23 @@ def is_ip(ip):
     import socket
     #first we test ipv4
     try:
-        if socket.inet_pton(socket.AF_INET, "%s" % (ip)):
-            return True
+        if windows_check():
+            if socket.inet_aton("%s" % (ip)):
+                return True
+        else:
+            if socket.inet_pton(socket.AF_INET, "%s" % (ip)):
+                return True
     except socket.error:
         if not socket.has_ipv6:
             return False
     #now test ipv6
     try:
-        if socket.inet_pton(socket.AF_INET6, "%s" % (ip)):
+        if windows_check():
+            log.warning("ipv6 check unavailable on windows")
             return True
+        else:
+            if socket.inet_pton(socket.AF_INET6, "%s" % (ip)):
+                return True
     except socket.error:
         return False
 

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to deluge-commit@googlegroups.com.
To unsubscribe from this group, send email to 
deluge-commit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to