From: Sage Weil Date: Fri, 4 Sep 2009 17:50:52 +0000 (-0700) Subject: msgr: small cleanup; hexdump code (disabled) X-Git-Tag: v0.14~31 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=52be66c1eb83c6e0ae95c1df0bd400f0530dd556;p=ceph.git msgr: small cleanup; hexdump code (disabled) --- diff --git a/src/msg/SimpleMessenger.cc b/src/msg/SimpleMessenger.cc index 414439099b5..189038d1f41 100644 --- a/src/msg/SimpleMessenger.cc +++ b/src/msg/SimpleMessenger.cc @@ -1635,6 +1635,41 @@ int SimpleMessenger::Pipe::do_sendmsg(int sd, struct msghdr *msg, int len) errno = EINTR; return -1; // close enough } + + if (0) { + // hex dump + struct iovec *v = msg->msg_iov; + size_t left = r; + size_t vpos = 0; + dout(0) << "do_sendmsg wrote " << r << " bytes, hexdump:\n"; + int pos = 0; + int col = 0; + char buf[20]; + while (left > 0) { + if (col == 0) { + sprintf(buf, "%05x : ", pos); + *_dout << buf; + } + sprintf(buf, " %02x", ((unsigned char*)v->iov_base)[vpos]); + *_dout << buf; + left--; + if (!left) + break; + vpos++; + pos++; + if (vpos == v->iov_len) { + v++; + vpos = 0; + } + col++; + if (col == 16) { + *_dout << "\n"; + col = 0; + } + } + *_dout << dendl; + } + len -= r; if (len == 0) break; @@ -1650,7 +1685,7 @@ int SimpleMessenger::Pipe::do_sendmsg(int sd, struct msghdr *msg, int len) } else { // partial! //dout(30) << "adjusting " << msg->msg_iov[0].iov_len << ", " << msg->msg_iovlen << " v, " << r << " left" << dendl; - msg->msg_iov[0].iov_base = (void*)((long)msg->msg_iov[0].iov_base + r); + msg->msg_iov[0].iov_base = (char *)msg->msg_iov[0].iov_base + r; msg->msg_iov[0].iov_len -= r; break; }