activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Motl <m...@orcsoftware.com>
Subject RE: SocketInputStream::read
Date Mon, 23 Apr 2007 13:55:08 GMT

Done.

https://issues.apache.org/activemq/browse/AMQCPP-107


Mittler, Nathan wrote:
> 
> Would you mind capturing this in a JIRA issue? 
> 
>> -----Original Message-----
>> From: Motl [mailto:motl@orcsoftware.com] 
>> Sent: Monday, April 23, 2007 8:56 AM
>> To: dev@activemq.apache.org
>> Subject: SocketInputStream::read
>> 
>> 
>> 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-tf3631398s23
>> 54.html#a10139680
>> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/SocketInputStream%3A%3Aread-tf3631398s2354.html#a10140655
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Mime
View raw message