BIND 10 trac1452, updated. 787a439b41c71c78a7de585d3603f477474426cc [1452] use recvfrom(2) with MSG_WAITALL instead of read(2). it seems that partial read can happen on some systems even if all data should have been transmitted.

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Dec 13 17:31:00 UTC 2011


The branch, trac1452 has been updated
       via  787a439b41c71c78a7de585d3603f477474426cc (commit)
      from  12649b6a44db756795a3160d1a70c7fe3a6fc9b1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 787a439b41c71c78a7de585d3603f477474426cc
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Dec 13 09:29:15 2011 -0800

    [1452] use recvfrom(2) with MSG_WAITALL instead of read(2).  it seems that
    partial read can happen on some systems even if all data should have been
    transmitted.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/util/io/socketsession.cc |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/util/io/socketsession.cc b/src/lib/util/io/socketsession.cc
index 65303cc..2cfa402 100644
--- a/src/lib/util/io/socketsession.cc
+++ b/src/lib/util/io/socketsession.cc
@@ -271,12 +271,13 @@ SocketSessionReceptor::pop() {
     // TODO: error check
 
     uint16_t header_len;
-    const int cc = read(impl_->fd_, &header_len, sizeof(header_len));
+    const int cc = recv(impl_->fd_, &header_len, sizeof(header_len),
+                        MSG_WAITALL);
     assert(cc == sizeof(header_len)); // XXX
     header_len = InputBuffer(&header_len, sizeof(header_len)).readUint16();
     impl_->header_buf_.clear();
     impl_->header_buf_.resize(header_len);
-    read(impl_->fd_, &impl_->header_buf_[0], header_len);
+    recv(impl_->fd_, &impl_->header_buf_[0], header_len, MSG_WAITALL);
 
     InputBuffer ibuffer(&impl_->header_buf_[0], header_len);
     const int family = static_cast<int>(ibuffer.readUint32());
@@ -292,7 +293,7 @@ SocketSessionReceptor::pop() {
 
     impl_->data_buf_.clear();
     impl_->data_buf_.resize(data_len);
-    read(impl_->fd_, &impl_->data_buf_[0], data_len);
+    recv(impl_->fd_, &impl_->data_buf_[0], data_len, MSG_WAITALL);
 
     return (SocketSession(passed_fd, family, type, protocol,
                           impl_->sa_local_, impl_->sa_remote_, data_len,




More information about the bind10-changes mailing list