qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nsan...@apache.org
Subject svn commit: r835504 - in /qpid/trunk/qpid/python: qmf/console.py qpid/managementdata.py
Date Thu, 12 Nov 2009 19:14:50 GMT
Author: nsantos
Date: Thu Nov 12 19:14:49 2009
New Revision: 835504

URL: http://svn.apache.org/viewvc?rev=835504&view=rev
Log:
replace gethostbyname() with getaddrinfo(), which supports IPv6 addresses and is thread-safe

Modified:
    qpid/trunk/qpid/python/qmf/console.py
    qpid/trunk/qpid/python/qpid/managementdata.py

Modified: qpid/trunk/qpid/python/qmf/console.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qmf/console.py?rev=835504&r1=835503&r2=835504&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qmf/console.py (original)
+++ qpid/trunk/qpid/python/qmf/console.py Thu Nov 12 19:14:49 2009
@@ -97,12 +97,12 @@
 class BrokerURL(URL):
   def __init__(self, text):
     URL.__init__(self, text)
-    socket.gethostbyname(self.host)
     if self.port is None:
       if self.scheme == URL.AMQPS:
         self.port = 5671
       else:
         self.port = 5672
+    socket.getaddrinfo(self.host, self.port)[0][4][0]
     self.authName = None
     self.authPass = None
     if self.user:
@@ -114,7 +114,7 @@
     return self.host + ":" + str(self.port)
 
   def match(self, host, port):
-    return socket.gethostbyname(self.host) == socket.gethostbyname(host) and self.port ==
port
+    return socket.getaddrinfo(self.host, self.port)[0][4] == socket.gethostbyname(host, port)[0][4]
 
 class Object(object):
   """ This class defines a 'proxy' object representing a real managed object on an agent.

Modified: qpid/trunk/qpid/python/qpid/managementdata.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/managementdata.py?rev=835504&r1=835503&r2=835504&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/managementdata.py (original)
+++ qpid/trunk/qpid/python/qpid/managementdata.py Thu Nov 12 19:14:49 2009
@@ -48,9 +48,9 @@
     if not match: raise ValueError("'%s' is not a valid broker url" % (text))
     user, password, host, port = match.groups()
 
-    self.host = socket.gethostbyname (host)
     if port: self.port = int(port)
     else: self.port = 5672
+    self.host = socket.getaddrinfo(host, self.port)[0][4][0]
     self.username = user or "guest"
     self.password = password or "guest"
 



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message