Author: tabish
Date: Fri Jan 23 06:28:24 2009
New Revision: 737030
URL: http://svn.apache.org/viewvc?rev=737030&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQCPP-219
Applied patch for Socket code on Solaris
Modified:
activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/decaf/net/SocketInputStream.cpp
activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/decaf/net/TcpSocket.cpp
Modified:
activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/decaf/net/SocketInputStream.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/decaf/net/SocketInputStream.cpp?rev=737030&r1=737029&r2=737030&view=diff
==============================================================================
---
activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/decaf/net/SocketInputStream.cpp
(original)
+++
activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/decaf/net/SocketInputStream.cpp
Fri Jan 23 06:28:24 2009
@@ -17,7 +17,10 @@
#include <decaf/util/Config.h>
-#if !defined(HAVE_WINSOCK2_H)
+#include <apr.h>
+#include <apr_portable.h>
+
+#ifndef HAVE_WINSOCK2_H
#include <sys/select.h>
#include <sys/socket.h>
#else
@@ -27,6 +30,7 @@
#ifdef HAVE_SYS_IOCTL_H
#define BSD_COMP /* Get FIONREAD on Solaris2. */
#include <sys/ioctl.h>
+#include <unistd.h>
#endif
// Pick up FIONREAD on Solaris 2.5.
@@ -44,8 +48,6 @@
#include <stdio.h>
#include <iostream>
-#include <apr_portable.h>
-
using namespace decaf;
using namespace decaf::net;
using namespace decaf::io;
Modified:
activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/decaf/net/TcpSocket.cpp
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/decaf/net/TcpSocket.cpp?rev=737030&r1=737029&r2=737030&view=diff
==============================================================================
---
activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/decaf/net/TcpSocket.cpp
(original)
+++
activemq/activemq-cpp/branches/activemq-cpp-2.x/src/main/decaf/net/TcpSocket.cpp
Fri Jan 23 06:28:24 2009
@@ -20,6 +20,7 @@
#include "SocketInputStream.h"
#include "SocketOutputStream.h"
#include "SocketError.h"
+#include <decaf/net/SocketException.h>
using namespace decaf;
using namespace decaf::internal;
@@ -29,14 +30,14 @@
////////////////////////////////////////////////////////////////////////////////
TcpSocket::TcpSocket() throw ( SocketException )
- : socketHandle( INVALID_SOCKET_HANDLE ),
+ : socketHandle( static_cast< SocketHandle >( INVALID_SOCKET_HANDLE ) ),
inputStream( NULL ),
outputStream( NULL ) {
}
////////////////////////////////////////////////////////////////////////////////
TcpSocket::TcpSocket( SocketHandle socketHandle )
- : socketHandle( INVALID_SOCKET_HANDLE ),
+ : socketHandle( static_cast< SocketHandle >( INVALID_SOCKET_HANDLE ) ),
inputStream( NULL ),
outputStream( NULL ) {
@@ -101,13 +102,13 @@
checkResult( apr_socket_create(
&socketHandle, socketAddress->family, SOCK_STREAM, APR_PROTO_TCP,
apr_pool.getAprPool() ) );
- // To make blocking-with-timeout sockets, we have to set it to
- // 'APR_SO_NONBLOCK==1(on) and timeout>0'. On Unix, we have no
- // problem to specify 'APR_SO_NONBLOCK==0(off) and timeout>0'.
- // Unfortunatelly, we have a problem on Windows. Setting the
- // mode to 'APR_SO_NONBLOCK==0(off) and timeout>0' causes
- // blocking-with-system-timeout sockets on Windows.
- //
+ // To make blocking-with-timeout sockets, we have to set it to
+ // 'APR_SO_NONBLOCK==1(on) and timeout>0'. On Unix, we have no
+ // problem to specify 'APR_SO_NONBLOCK==0(off) and timeout>0'.
+ // Unfortunatelly, we have a problem on Windows. Setting the
+ // mode to 'APR_SO_NONBLOCK==0(off) and timeout>0' causes
+ // blocking-with-system-timeout sockets on Windows.
+ //
//
http://dev.ariel-networks.com/apr/apr-tutorial/html/apr-tutorial-13.html
// If we have a connection timeout specified, temporarily set the
socket to
@@ -115,7 +116,7 @@
// to blocking mode right after we connect.
apr_socket_opt_set( socketHandle, APR_SO_NONBLOCK, (timeout>0)?1:0 );
apr_socket_timeout_set( socketHandle, timeout );
-
+
// Connect to the broker.
checkResult(apr_socket_connect( socketHandle, socketAddress ));