mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:07:34 +00:00
LibIPC: Remove use of ByteBuffer::wrap()
ByteBuffer::wrap() was useful before we had Span. Let's see if we can't get rid of some more ByteBuffer wrapping.
This commit is contained in:
parent
d893498e57
commit
0e4ecca336
2 changed files with 5 additions and 5 deletions
|
@ -214,7 +214,7 @@ protected:
|
|||
if (message_size == 0 || bytes.size() - index - sizeof(uint32_t) < message_size)
|
||||
break;
|
||||
index += sizeof(message_size);
|
||||
auto remaining_bytes = ByteBuffer::wrap(bytes.data() + index, bytes.size() - index);
|
||||
auto remaining_bytes = ReadonlyBytes { bytes.data() + index, bytes.size() - index };
|
||||
if (auto message = LocalEndpoint::decode_message(remaining_bytes, m_socket->fd())) {
|
||||
m_unprocessed_messages.append(message.release_nonnull());
|
||||
} else if (auto message = PeerEndpoint::decode_message(remaining_bytes, m_socket->fd())) {
|
||||
|
@ -229,12 +229,13 @@ protected:
|
|||
// Sometimes we might receive a partial message. That's okay, just stash away
|
||||
// the unprocessed bytes and we'll prepend them to the next incoming message
|
||||
// in the next run of this function.
|
||||
auto remaining_bytes = ByteBuffer::wrap(bytes.data() + index, bytes.size() - index);
|
||||
auto remaining_bytes = ByteBuffer::copy(bytes.data() + index, bytes.size() - index);
|
||||
if (!m_unprocessed_bytes.is_empty()) {
|
||||
dbg() << *this << "::drain_messages_from_peer: Already have unprocessed bytes";
|
||||
shutdown();
|
||||
return false;
|
||||
}
|
||||
m_unprocessed_bytes = remaining_bytes.isolated_copy();
|
||||
m_unprocessed_bytes = remaining_bytes;
|
||||
}
|
||||
|
||||
if (!m_unprocessed_messages.is_empty()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue