llmessage v2 merge.
This commit is contained in:
@@ -178,7 +178,7 @@ LLSocket::ptr_t LLSocket::create(EType type, U16 port)
|
||||
port = PORT_EPHEMERAL;
|
||||
}
|
||||
rv->mPort = port;
|
||||
rv->setOptions();
|
||||
rv->setNonBlocking();
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ LLSocket::ptr_t LLSocket::create(apr_status_t& status, LLSocket::ptr_t& listen_s
|
||||
return rv;
|
||||
}
|
||||
rv->mPort = PORT_EPHEMERAL;
|
||||
rv->setOptions();
|
||||
rv->setNonBlocking();
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -221,10 +221,10 @@ bool LLSocket::blockingConnect(const LLHost& host)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
apr_socket_timeout_set(mSocket, 1000);
|
||||
setBlocking(1000);
|
||||
ll_debug_socket("Blocking connect", mSocket);
|
||||
if(ll_apr_warn_status(apr_socket_connect(mSocket, sa))) return false;
|
||||
setOptions();
|
||||
setNonBlocking();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -246,11 +246,27 @@ LLSocket::~LLSocket()
|
||||
}
|
||||
}
|
||||
|
||||
void LLSocket::setOptions()
|
||||
// See http://dev.ariel-networks.com/apr/apr-tutorial/html/apr-tutorial-13.html#ss13.4
|
||||
// for an explanation of how to get non-blocking sockets and timeouts with
|
||||
// consistent behavior across platforms.
|
||||
|
||||
void LLSocket::setBlocking(S32 timeout)
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_IO_TCP);
|
||||
// set up the socket options
|
||||
ll_apr_warn_status(apr_socket_timeout_set(mSocket, timeout));
|
||||
ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_NONBLOCK, 0));
|
||||
ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_SNDBUF, LL_SEND_BUFFER_SIZE));
|
||||
ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_RCVBUF, LL_RECV_BUFFER_SIZE));
|
||||
|
||||
}
|
||||
|
||||
void LLSocket::setNonBlocking()
|
||||
{
|
||||
LLMemType m1(LLMemType::MTYPE_IO_TCP);
|
||||
// set up the socket options
|
||||
ll_apr_warn_status(apr_socket_timeout_set(mSocket, 0));
|
||||
ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_NONBLOCK, 1));
|
||||
ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_SNDBUF, LL_SEND_BUFFER_SIZE));
|
||||
ll_apr_warn_status(apr_socket_opt_set(mSocket, APR_SO_RCVBUF, LL_RECV_BUFFER_SIZE));
|
||||
|
||||
@@ -588,6 +604,7 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
|
||||
{
|
||||
chain.push_back(LLIOPipe::ptr_t(new LLIOSocketWriter(llsocket)));
|
||||
pump->addChain(chain, mResponseTimeout);
|
||||
status = STATUS_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user