Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2FFEC8715 for ; Fri, 12 Aug 2011 22:33:02 +0000 (UTC) Received: (qmail 43869 invoked by uid 500); 12 Aug 2011 22:33:02 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 43850 invoked by uid 500); 12 Aug 2011 22:33:02 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 43843 invoked by uid 99); 12 Aug 2011 22:33:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2011 22:33:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Aug 2011 22:33:00 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B4D842388A56 for ; Fri, 12 Aug 2011 22:32:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1157276 - /qpid/trunk/qpid/python/qpid/util.py Date: Fri, 12 Aug 2011 22:32:41 -0000 To: commits@qpid.apache.org From: astitcher@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110812223241.B4D842388A56@eris.apache.org> Author: astitcher Date: Fri Aug 12 22:32:41 2011 New Revision: 1157276 URL: http://svn.apache.org/viewvc?rev=1157276&view=rev Log: QPID-3407: Add IPv6 connections to python Modified: qpid/trunk/qpid/python/qpid/util.py Modified: qpid/trunk/qpid/python/qpid/util.py URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/util.py?rev=1157276&r1=1157275&r2=1157276&view=diff ============================================================================== --- qpid/trunk/qpid/python/qpid/util.py (original) +++ qpid/trunk/qpid/python/qpid/util.py Fri Aug 12 22:32:41 2011 @@ -39,12 +39,17 @@ except ImportError: self.sock.close() def connect(host, port): - sock = socket.socket() - sock.connect((host, port)) - sock.setblocking(1) - # XXX: we could use this on read, but we'd have to put write in a - # loop as well - # sock.settimeout(1) + for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM): + af, socktype, proto, canonname, sa = res + sock = socket.socket(af, socktype, proto) + try: + sock.connect(sa) + break + except socket.error, msg: + sock.close + else: + # If we got here then we couldn't connect (yet) + raise return sock def listen(host, port, predicate = lambda: True, bound = lambda: None): --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscribe@qpid.apache.org