Bug 1051567 - Make sure we resend file descriptors for the first chunk of a message. r=billm

Check if the buffers iterator was never consumed. This is a regression
introduced when converting ipc to use BufferList in bug 1262671.

MozReview-Commit-ID: LWAoVlI5CKJ

--HG--
extra : rebase_source : c4f16f4f90f56153c10cf1d9113c4c55748595f0
This commit is contained in:
Kan-Ru Chen 2016-08-30 18:26:59 +08:00
parent f3842d776e
commit 99748028a6
2 changed files with 7 additions and 6 deletions

View File

@ -579,7 +579,12 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
int[FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE])); int[FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE]));
char buf[tmp]; char buf[tmp];
if (partial_write_iter_.isNothing() && if (partial_write_iter_.isNothing()) {
Pickle::BufferList::IterImpl iter(msg->Buffers());
partial_write_iter_.emplace(iter);
}
if (partial_write_iter_.value().Data() == msg->Buffers().Start() &&
!msg->file_descriptor_set()->empty()) { !msg->file_descriptor_set()->empty()) {
// This is the first chunk of a message which has descriptors to send // This is the first chunk of a message which has descriptors to send
struct cmsghdr *cmsg; struct cmsghdr *cmsg;
@ -611,11 +616,6 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
size_t iov_count = 0; size_t iov_count = 0;
size_t amt_to_write = 0; size_t amt_to_write = 0;
if (partial_write_iter_.isNothing()) {
Pickle::BufferList::IterImpl iter(msg->Buffers());
partial_write_iter_.emplace(iter);
}
// How much of this message have we written so far? // How much of this message have we written so far?
Pickle::BufferList::IterImpl iter = partial_write_iter_.value(); Pickle::BufferList::IterImpl iter = partial_write_iter_.value();

View File

@ -228,6 +228,7 @@ class BufferList : private AllocPolicy
// Special convenience method that returns Iter().Data(). // Special convenience method that returns Iter().Data().
char* Start() { return mSegments[0].mData; } char* Start() { return mSegments[0].mData; }
const char* Start() const { return mSegments[0].mData; }
IterImpl Iter() const { return IterImpl(*this); } IterImpl Iter() const { return IterImpl(*this); }