Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 94486 invoked from network); 16 Jul 2010 15:41:23 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Jul 2010 15:41:23 -0000 Received: (qmail 61824 invoked by uid 500); 16 Jul 2010 15:41:23 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 61768 invoked by uid 500); 16 Jul 2010 15:41:23 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 61761 invoked by uid 99); 16 Jul 2010 15:41:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jul 2010 15:41:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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, 16 Jul 2010 15:41:20 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2B5BA2388900; Fri, 16 Jul 2010 15:39:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r964840 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net: InetAddress.cpp InetAddress.h Date: Fri, 16 Jul 2010 15:39:57 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100716153957.2B5BA2388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tabish Date: Fri Jul 16 15:39:56 2010 New Revision: 964840 URL: http://svn.apache.org/viewvc?rev=964840&view=rev Log: fix for: https://issues.apache.org/activemq/browse/AMQCPP-303 Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.cpp activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.h Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.cpp?rev=964840&r1=964839&r2=964840&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.cpp (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.cpp Fri Jul 16 15:39:56 2010 @@ -37,9 +37,6 @@ using namespace decaf::internal; const unsigned char InetAddress::loopbackBytes[4] = { 127, 0, 0, 1 }; const unsigned char InetAddress::anyBytes[4] = { 0, 0, 0, 0 }; -const InetAddress InetAddress::LOOPBACK( Inet4Address( "localhost", InetAddress::loopbackBytes, 4 ) ); -const InetAddress InetAddress::ANY( Inet4Address( InetAddress::anyBytes, 4 ) ); - //////////////////////////////////////////////////////////////////////////////// InetAddress::InetAddress() { } @@ -161,7 +158,7 @@ InetAddress InetAddress::getLocalHost() apr_status_t result = apr_gethostname( hostname, APRMAXHOSTLEN+1, pool.getAprPool() ); if( result != APR_SUCCESS ) { - return InetAddress::LOOPBACK; + return getLoopbackAddress(); } apr_sockaddr_t* address = NULL; @@ -195,3 +192,13 @@ unsigned int InetAddress::bytesToInt( co return value; } + +//////////////////////////////////////////////////////////////////////////////// +InetAddress InetAddress::getAnyAddress() { + return Inet4Address( "localhost", InetAddress::loopbackBytes, 4 ); +} + +//////////////////////////////////////////////////////////////////////////////// +InetAddress InetAddress::getLoopbackAddress() { + return Inet4Address( InetAddress::anyBytes, 4 ); +} Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.h?rev=964840&r1=964839&r2=964840&view=diff ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.h (original) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/InetAddress.h Fri Jul 16 15:39:56 2010 @@ -36,9 +36,6 @@ namespace net { static const unsigned char loopbackBytes[4]; static const unsigned char anyBytes[4]; - static const InetAddress ANY; - static const InetAddress LOOPBACK; - protected: mutable std::string hostname; @@ -242,6 +239,10 @@ namespace net { */ static unsigned int bytesToInt( const unsigned char* bytes, int start ); + static InetAddress getAnyAddress(); + + static InetAddress getLoopbackAddress(); + }; }}