Skip to content

Commit

Permalink
let Cursor::peek return span
Browse files Browse the repository at this point in the history
Summary:
Currently, `CursorBase::peek()` returns `pair<uint8_t const*, size_t>` and `CursorBase::peekView()` returns `basic_string_view<uint8_t>`. Consolidate them into `CursorBase::peek()` returning `span<uint8_t const>`.

As one motivation, libc++ v19 removes `basic_string_view<uint8_t>`.

Reviewed By: thevinster

Differential Revision: D62460851

fbshipit-source-id: 72d567817faf778287594c10dfd7f6f379bf2446
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Sep 13, 2024
1 parent a8bf00e commit e901a4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions quic/server/QuicServerPacketRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ void TakeoverPacketHandler::processForwardedPacket(
}
struct sockaddr* sockaddr = nullptr;
uint8_t sockaddrBuf[kMaxBufSizeForTakeoverEncapsulation];
std::pair<const uint8_t*, size_t> addrData = cursor.peek();
if (addrData.second >= addrLen) {
auto addrData = cursor.peek();
if (addrData.size() >= addrLen) {
// the address is contiguous in the queue
sockaddr = (struct sockaddr*)addrData.first;
sockaddr = (struct sockaddr*)addrData.data();
cursor.skip(addrLen);
} else {
// the address is not contiguous, copy it to a local buffer
Expand Down

0 comments on commit e901a4d

Please sign in to comment.