]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
msgr: use provided rx buffer if present
authorSage Weil <sage@newdream.net>
Mon, 15 Nov 2010 04:26:52 +0000 (20:26 -0800)
committerSage Weil <sage@newdream.net>
Mon, 15 Nov 2010 04:39:07 +0000 (20:39 -0800)
commit7cb2d50850cd8028750b4f9ebb805f2325e47bb2
tree36bae1fa484dd6c729e25d8f2a03f52e4dfef2ec
parent2854dae80f5c5c113e4162bd7365980fa743f05a
msgr: use provided rx buffer if present

This changes the read path so that we hold the Connection::lock mutex while
reading data off the socket.  This ensures that we are reading into a
buffer we are allowed to use, and allows users to revoke a previously
posted buffer.  If that happens, switch over to a newly allocated buffer.

Note that currently the final result bufferlist may contain part of the
provided buffer and part of a newly allocated buffer.  This is okay as long
as we will always read the same data into the buffer.  And in practice, if
the rx buffer is revoked then the message itself will be thrown out anyway.

Signed-off-by: Sage Weil <sage@newdream.net>
src/msg/SimpleMessenger.cc
src/msg/tcp.cc
src/msg/tcp.h