You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2007/01/26 01:53:43 UTC
svn commit: r500075 -
/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp
Author: nmittler
Date: Thu Jan 25 16:53:42 2007
New Revision: 500075
URL: http://svn.apache.org/viewvc?view=rev&rev=500075
Log:
[AMQCPP-46] Fixed receipt of SIGPIPE on OS X when sending disconnect message on a broken socket
Modified:
incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp
Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp
URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp?view=diff&rev=500075&r1=500074&r2=500075
==============================================================================
--- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp (original)
+++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/network/TcpSocket.cpp Thu Jan 25 16:53:42 2007
@@ -135,19 +135,19 @@
"Socket::connect- Port out of range: %d", port );
}
-#ifdef SO_NOSIGPIPE
+#ifdef SO_NOSIGPIPE // Don't want to get a SIGPIPE on FreeBSD and Mac OS X
+
+ int optval = 1;
+ if( ::setsockopt( socketHandle,
+ SOL_SOCKET, SO_NOSIGPIPE,
+ (char*)&optval,
+ sizeof(optval)) < 0 )
{
- int optval = 1;
- if( ::setsockopt( socketHandle,
- SOL_SOCKET, SO_NOSIGPIPE,
- (char*)&optval,
- sizeof(optval)) < 0 )
- {
- close();
- throw SocketException ( __FILE__, __LINE__,
- "Socket::connect- Failed setting SO_NOSIGPIPE: %s", SocketError::getErrorString().c_str() );
- }
+ close();
+ throw SocketException ( __FILE__, __LINE__,
+ "Socket::connect- Failed setting SO_NOSIGPIPE: %s", SocketError::getErrorString().c_str() );
}
+
#endif
sockaddr_in target_addr;