summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-12-01 18:59:17 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-12-01 18:59:17 +0000
commit5400c7202d7da72138177b9e5a735cb4f9d46398 (patch)
tree64f35a00e4c0b2834f315675d8d17afc7f490c78 /ace
parent26bbf36f13d703e0d54c58034c493274c49374c2 (diff)
downloadATCD-5400c7202d7da72138177b9e5a735cb4f9d46398.tar.gz
(recv,recv_n): set errno to ESUCCESS. (eof): cleaned up a bit.
Diffstat (limited to 'ace')
-rw-r--r--ace/IOStream_T.i25
1 files changed, 14 insertions, 11 deletions
diff --git a/ace/IOStream_T.i b/ace/IOStream_T.i
index bf9a4505693..c145eb52cc3 100644
--- a/ace/IOStream_T.i
+++ b/ace/IOStream_T.i
@@ -21,6 +21,8 @@ ACE_Streambuf_T<STREAM>::recv (char *buf,
int flags,
ACE_Time_Value * tv)
{
+ this->timeout_ = 0;
+ errno = ESUCCESS;
ssize_t rval = peer_->recv (buf, len, flags, tv);
if (errno == ETIME)
this->timeout_ = 1;
@@ -34,8 +36,9 @@ ACE_Streambuf_T<STREAM>::recv_n (char *buf,
ACE_Time_Value *tv)
{
this->timeout_ = 0;
+ errno = ESUCCESS;
ssize_t rval = peer_->recv_n (buf, len, flags, tv);
- if (rval == -1 && errno == ETIME)
+ if (errno == ETIME)
this->timeout_ = 1;
return rval;
}
@@ -49,13 +52,6 @@ ACE_Streambuf_T<STREAM>::get_handle (void)
template <class STREAM> ACE_INLINE int
ACE_IOStream<STREAM>::eof (void) const
{
-#if 0
- char c;
- return ACE_OS::recv (this->get_handle (),
- &c,
- sizeof c,
- MSG_PEEK) <= 0;
-#endif /* 0 */
// Get the timeout value of the streambuf
ACE_Time_Value *timeout = this->streambuf_->recv_timeout (0);
@@ -68,9 +64,16 @@ ACE_IOStream<STREAM>::eof (void) const
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();
+ // Timeout, not an eof
+ if (this->streambuf_->timeout())
+ return 0;
+
+ // No timeout, got enough data: not eof
+ if (rval == sizeof(char))
+ return 0;
+
+ // No timeout, not enough data: definately eof
+ return 1;
}
template <class STREAM> ACE_INLINE