mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-01 01:44:22 +03:00
Remove cmsgs from the outstanding packet.
Summary: Remove cmsgs from each outstanding packet. Storing this as a map is excessive. Instead store it as a packed enum. This supports one kind of mark per packet. If we ned to we could in the future support multiple types of marks per packet by using a bitset-style flag, e.g. each bit index representing a different mark. For now just use an enum. Reviewed By: jbeshay Differential Revision: D57397865 fbshipit-source-id: 6d34215c9d7e39537c44c6c304a8ce3a5883541e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e88acd81b2
commit
3cac323c08
@ -884,7 +884,7 @@ void updateConnection(
|
||||
conn.appLimitedTracker.getTotalAppLimitedTime(),
|
||||
std::move(packetDestroyFn));
|
||||
|
||||
pkt.metadata.cmsgs = conn.socketCmsgsState.additionalCmsgs;
|
||||
maybeAddPacketMark(conn, pkt);
|
||||
|
||||
pkt.isAppLimited = conn.congestionController
|
||||
? conn.congestionController->isAppLimited()
|
||||
@ -2032,4 +2032,34 @@ void maybeVerifyPendingKeyUpdate(
|
||||
}
|
||||
}
|
||||
|
||||
// Unfortunate, we should make this more portable.
|
||||
#if !defined IPV6_HOPLIMIT
|
||||
#define IPV6_HOPLIMIT -1
|
||||
#endif
|
||||
#if !defined IP_TTL
|
||||
#define IP_TTL -1
|
||||
#endif
|
||||
// Add a packet mark to the outstanding packet. Currently only supports
|
||||
// TTLD marking.
|
||||
void maybeAddPacketMark(
|
||||
QuicConnectionStateBase& conn,
|
||||
OutstandingPacketWrapper& op) {
|
||||
static constexpr folly::SocketOptionKey kHopLimitOptionKey = {
|
||||
IPPROTO_IPV6, IPV6_HOPLIMIT};
|
||||
static constexpr folly::SocketOptionKey kTTLOptionKey = {IPPROTO_IP, IP_TTL};
|
||||
if (!conn.socketCmsgsState.additionalCmsgs.has_value()) {
|
||||
return;
|
||||
}
|
||||
const auto& cmsgs = conn.socketCmsgsState.additionalCmsgs;
|
||||
auto it = cmsgs->find(kHopLimitOptionKey);
|
||||
if (it != cmsgs->end() && it->second == 255) {
|
||||
op.metadata.mark = OutstandingPacketMark::TTLD;
|
||||
return;
|
||||
}
|
||||
it = cmsgs->find(kTTLOptionKey);
|
||||
if (it != cmsgs->end() && it->second == 255) {
|
||||
op.metadata.mark = OutstandingPacketMark::TTLD;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace quic
|
||||
|
Reference in New Issue
Block a user