Great - thanks!
> -----Original Message----- > From: Motl [mailto:[EMAIL PROTECTED] > Sent: Monday, April 23, 2007 9:55 AM > To: [email protected] > Subject: RE: SocketInputStream::read > > > 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:[EMAIL PROTECTED] > >> Sent: Monday, April 23, 2007 8:56 AM > >> To: [email protected] > >> 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-tf3631398s23 > 54.html#a10140655 > Sent from the ActiveMQ - Dev mailing list archive at Nabble.com. > >
