activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r936365 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net: ServerSocket.cpp Socket.cpp SocketImpl.h
Date Wed, 21 Apr 2010 15:51:38 GMT
Author: tabish
Date: Wed Apr 21 15:51:38 2010
New Revision: 936365

URL: http://svn.apache.org/viewvc?rev=936365&view=rev
Log:
Adds several fixes to the Socket and ServerSocket classes found during testing, also adds
some temporary debug code.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketImpl.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.cpp?rev=936365&r1=936364&r2=936365&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/ServerSocket.cpp Wed Apr 21
15:51:38 2010
@@ -107,8 +107,10 @@ void ServerSocket::setupSocketImpl( cons
         this->impl->create();
         this->created = true;
 
+        std::string bindAddr = ipAddress.empty() ? "0.0.0.0" : ipAddress;
+
         try {
-            this->impl->bind( ipAddress, port );
+            this->impl->bind( bindAddr, port );
             this->bound = true;
             this->impl->listen( backlog > 0 ? backlog : getDefaultBacklog() );
         } catch( IOException& ex ) {
@@ -325,6 +327,16 @@ void ServerSocket::setSoTimeout( int tim
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+int ServerSocket::getLocalPort() const {
+
+    if( this->impl == NULL ) {
+        return -1;
+    }
+
+    return this->impl->getLocalPort();
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void ServerSocket::setSocketImplFactory( SocketImplFactory* factory )
     throw( decaf::io::IOException,
            decaf::net::SocketException ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.cpp?rev=936365&r1=936364&r2=936365&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/Socket.cpp Wed Apr 21 15:51:38
2010
@@ -127,9 +127,9 @@ void Socket::initSocketImpl( const std::
         ensureCreated();
 
         try {
-            this->impl->bind( localAddress, localPort );
+            //this->impl->bind( localAddress, localPort );
             this->bound = true;
-            this->impl->connect( host, port, 0 );
+            this->impl->connect( host, port, -1 );
             this->connected = true;
         } catch( IOException& ex ) {
             this->impl->close();
@@ -178,7 +178,9 @@ void Socket::bind( const std::string& ip
         ensureCreated();
 
         try {
+            std::cout << "Socket::bind - Binding to " << ipaddress << ":"
<< port << std::endl;
             this->impl->bind( ipaddress, port );
+            std::cout << "Socket::bind - Bound to " << ipaddress << ":"
<< port << std::endl;
             this->bound = true;
         } catch( IOException& e ) {
             this->impl->close();
@@ -249,12 +251,14 @@ void Socket::connect( const std::string&
         try {
 
             if( !isBound() ) {
-                this->impl->bind( "", 0 );
+                //this->impl->bind( "", 0 );
                 this->bound = true;
             }
 
+            std::cout << "Socket::connect - Connecting to " << host <<
":" << port << std::endl;
             this->impl->connect( host, port, timeout );
             this->connected = true;
+            std::cout << "Socket::connect - Connected to " << host << ":"
<< port << std::endl;
 
         } catch( IOException& ex ) {
             this->impl->close();

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketImpl.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketImpl.h?rev=936365&r1=936364&r2=936365&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketImpl.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/net/SocketImpl.h Wed Apr 21 15:51:38
2010
@@ -38,7 +38,7 @@ namespace net {
      * @since 1.0
      */
     class DECAF_API SocketImpl : public SocketOptions {
-    private:
+    protected:
 
         int port;
         int localPort;



Mime
View raw message