activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r530105 - /activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp
Date Wed, 18 Apr 2007 17:53:20 GMT
Author: tabish
Date: Wed Apr 18 10:53:20 2007
New Revision: 530105

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

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp?view=diff&rev=530105&r1=530104&r2=530105
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp Wed Apr
18 10:53:20 2007
@@ -30,6 +30,7 @@
     #include <netinet/in.h>
     #include <arpa/inet.h>
     #include <string.h>
+    #include <netinet/tcp.h>
 #endif
 
 #ifndef SHUT_RDWR
@@ -412,11 +413,26 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 bool TcpSocket::getTcpNoDelay() const throw ( cms::CMSException ) {
-    return false;
+
+    try{
+        int value;
+        socklen_t length = sizeof( int );
+        checkResult(::getsockopt( socketHandle, IPPROTO_TCP, TCP_NODELAY, (char*)&value,
&length ));
+        return value != 0;
+    }
+    AMQ_CATCH_RETHROW( SocketException )
+    AMQ_CATCHALL_THROW( SocketException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void TcpSocket::setTcpNoDelay( bool value ) throw ( cms::CMSException ) {
+
+    try{
+        int ivalue = value ? 1 : 0;
+        checkResult(::setsockopt( socketHandle, IPPROTO_TCP, TCP_NODELAY, (char*)&ivalue,
sizeof(int) ));
+    }
+    AMQ_CATCH_RETHROW( SocketException )
+    AMQ_CATCHALL_THROW( SocketException )
 }
 
 ////////////////////////////////////////////////////////////////////////////////



Mime
View raw message