Skip to content

Commit

Permalink
Bug 1051567 - Make sure we resend file descriptors for the first chun…
Browse files Browse the repository at this point in the history
…k 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
  • Loading branch information
kanru committed Aug 30, 2016
1 parent 8a9e052 commit 0416121
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ipc/chromium/src/chrome/common/ipc_channel_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,12 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
int[FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE]));
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()) {
// This is the first chunk of a message which has descriptors to send
struct cmsghdr *cmsg;
Expand Down Expand Up @@ -611,11 +616,6 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
size_t iov_count = 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?
Pickle::BufferList::IterImpl iter = partial_write_iter_.value();

Expand Down
1 change: 1 addition & 0 deletions mfbt/BufferList.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ class BufferList : private AllocPolicy

// Special convenience method that returns Iter().Data().
char* Start() { return mSegments[0].mData; }
const char* Start() const { return mSegments[0].mData; }

IterImpl Iter() const { return IterImpl(*this); }

Expand Down

0 comments on commit 0416121

Please sign in to comment.