diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-02 02:30:35 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-02 02:30:35 +0000 |
commit | 018608a8b883cd8b6ee1da2b6342bac7a829508b (patch) | |
tree | 7d23b26e80229b93be7c526cc7d79dae72af0932 | |
parent | 842465872892c086c1b030cac0662a89c437b3fe (diff) | |
download | ATCD-018608a8b883cd8b6ee1da2b6342bac7a829508b.tar.gz |
(recv_n, eof): fixed calculation of timeout_ and return value
-rw-r--r-- | ace/IOStream_T.i | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/ace/IOStream_T.i b/ace/IOStream_T.i index fcf28fb02a6..cfbc4215b82 100644 --- a/ace/IOStream_T.i +++ b/ace/IOStream_T.i @@ -33,8 +33,9 @@ ACE_Streambuf_T<STREAM>::recv_n (char *buf, int flags, ACE_Time_Value *tv) { + this->timeout_ = 0; ssize_t rval = peer_->recv_n (buf, len, flags, tv); - if (errno == ETIME) + if (rval == -1 && errno == ETIME) this->timeout_ = 1; return rval; } @@ -60,16 +61,16 @@ ACE_IOStream<STREAM>::eof (void) const // Reset the timeout value of the streambuf. (void) this->streambuf_->recv_timeout (timeout); - + char c; 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 (); + return rval == -1 && ! this->streambuf_->timeout (); } template <class STREAM> ACE_INLINE |