activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r594200 - in /activemq/activemq-cpp/decaf/trunk/src: main/decaf/net/SocketInputStream.cpp test/decaf/net/SocketTest.cpp
Date Mon, 12 Nov 2007 16:17:03 GMT
Author: tabish
Date: Mon Nov 12 08:17:02 2007
New Revision: 594200

URL: http://svn.apache.org/viewvc?rev=594200&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103

turning on some unit tests, decaf socket inputstream available is segfaulting

Adding the test and solution to bad APR usage in SocketInputStream available.

Modified:
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/net/SocketInputStream.cpp
    activemq/activemq-cpp/decaf/trunk/src/test/decaf/net/SocketTest.cpp

Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/net/SocketInputStream.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/net/SocketInputStream.cpp?rev=594200&r1=594199&r2=594200&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/net/SocketInputStream.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/net/SocketInputStream.cpp Mon Nov 12
08:17:02 2007
@@ -71,8 +71,8 @@
 std::size_t SocketInputStream::available() const throw ( io::IOException ){
 
     // Convert to an OS level socket.
-    apr_os_sock_t* oss = NULL;
-    apr_os_sock_get( oss, socket );
+    apr_os_sock_t oss;
+    apr_os_sock_get( (apr_os_sock_t*)&oss, socket );
 
 // The windows version
 #if defined(HAVE_WINSOCK2_H)
@@ -92,7 +92,7 @@
     #if defined(FIONREAD)
 
         std::size_t numBytes = 0;
-        if( ::ioctl( *oss, FIONREAD, &numBytes ) != -1 ){
+        if( ::ioctl( oss, FIONREAD, &numBytes ) != -1 ){
             return numBytes;
         }
 
@@ -105,11 +105,11 @@
 
         fd_set rd;
         FD_ZERO(&rd);
-        FD_SET( *oss, &rd );
+        FD_SET( oss, &rd );
         struct timeval tv;
         tv.tv_sec = 0;
         tv.tv_usec = 0;
-        int returnCode = ::select( *oss+1, &rd, NULL, NULL, &tv );
+        int returnCode = ::select( oss+1, &rd, NULL, NULL, &tv );
         if( returnCode == -1 ){
             throw IOException(
                 __FILE__, __LINE__,

Modified: activemq/activemq-cpp/decaf/trunk/src/test/decaf/net/SocketTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/test/decaf/net/SocketTest.cpp?rev=594200&r1=594199&r2=594200&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/test/decaf/net/SocketTest.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/test/decaf/net/SocketTest.cpp Mon Nov 12 08:17:02
2007
@@ -162,6 +162,7 @@
         unsigned char buf[500];
         memset( buf, 0, 500 );
         io::InputStream* istream = client.getInputStream();
+        CPPUNIT_ASSERT( istream->available() != 0 );
         std::size_t numRead = istream->read( buf, 0, 500 );
         CPPUNIT_ASSERT( numRead == 5 );
         CPPUNIT_ASSERT( strcmp( (char*)buf, "hello" ) == 0 );



Mime
View raw message