Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuhiro-t committed Jun 9, 2016
1 parent e220c53 commit fd024e6
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/PeerConnection.cc
Expand Up @@ -150,22 +150,13 @@ bool PeerConnection::receiveMessage(unsigned char* data, size_t& dataLength)
else {
assert(resbufOffset_ == resbufLength_);
if (resbufLength_ != 0) {
if (msgOffset_ == 0 && resbufLength_ == currentPayloadLength_ + 4) {
// All bytes in buffer have been processed, so clear it
// away.
resbufLength_ = 0;
resbufOffset_ = 0;
msgOffset_ = 0;
}
else {
// Shift buffer so that resbuf_[msgOffset_] moves to
// rebuf_[0].
memmove(resbuf_.get(), resbuf_.get() + msgOffset_,
resbufLength_ - msgOffset_);
resbufLength_ -= msgOffset_;
resbufOffset_ = resbufLength_;
msgOffset_ = 0;
}
// Shift buffer so that resbuf_[msgOffset_] moves to
// rebuf_[0].
memmove(resbuf_.get(), resbuf_.get() + msgOffset_,
resbufLength_ - msgOffset_);
resbufLength_ -= msgOffset_;
resbufOffset_ = resbufLength_;
msgOffset_ = 0;
}
size_t nread;
// To reduce the amount of copy involved in buffer shift, large
Expand Down

0 comments on commit fd024e6

Please sign in to comment.