summaryrefslogtreecommitdiff
path: root/ace/IOStream_T.i
diff options
context:
space:
mode:
Diffstat (limited to 'ace/IOStream_T.i')
-rw-r--r--ace/IOStream_T.i20
1 files changed, 16 insertions, 4 deletions
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<STREAM>::get_handle (void)
template <class STREAM> ACE_INLINE int
ACE_IOStream<STREAM>::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();
}