>From SocketInputSream.cpp:
int len = ::recv(socket, (char*)buffer, (int)bufferSize, 0);
// Check for a closed socket.
if( len == 0 ){
throw IOException( __FILE__, __LINE__,
"activemq::io::SocketInputStream::read - The connection is
broken" );
}
// Check for error.
if( len == -1 ){
// Otherwise, this was a bad error - throw an exception.
throw IOException( __FILE__, __LINE__,
"activemq::io::SocketInputStream::read - %s",
SocketError::getErrorString().c_str() );
}
It's really worth to replace the condition check with smth like this:
while( errno == EINTR)
{
int len = ::recv(socket, (char*)buffer, (int)bufferSize, 0);
if( len == 0 ){
...
}
if( len == -1 ){
...
}
}
The abov is needed to avoid the situation when blocking read() call was
failed due to interruption by a signal.
--
View this message in context:
http://www.nabble.com/SocketInputStream%3A%3Aread-tf3631398s2354.html#a10139680
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.