From 9beba18c36fb876e8615c4a12517b8a41dcce4fd Mon Sep 17 00:00:00 2001 From: nw1 Date: Fri, 19 Dec 1997 23:22:39 +0000 Subject: Incoporate James CE Johnson's patches. --- ace/IOStream_T.i | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'ace/IOStream_T.i') diff --git a/ace/IOStream_T.i b/ace/IOStream_T.i index e97583cafc7..49ee5a19d28 100644 --- a/ace/IOStream_T.i +++ b/ace/IOStream_T.i @@ -43,11 +43,23 @@ ACE_Streambuf_T::get_handle (void) template ACE_INLINE int ACE_IOStream::eof (void) const { +// char c; +// return ACE_OS::recv (this->get_handle (), +// &c, +// sizeof c, +// MSG_PEEK) <= 0; + // Get the timeout value of the streambuf + ACE_Time_Value * timeout = this->streambuf_->recv_timeout(0); + + // Reset the timeout value of the streambuf + (void)this->streambuf_->recv_timeout(timeout); + char c; - return ACE_OS::recv (this->get_handle (), - &c, - sizeof c, - MSG_PEEK) <= 0; + int rval = this->streambuf_->recv_n( &c, sizeof c, MSG_PEEK, timeout ); + + // If recv_n() didn't fail or failed because of timeout we're + // not at EOF. + return rval != -1 && ! this->streambuf_->timeout(); } -- cgit v1.2.1