mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-08 09:42:06 +03:00
Support setting cmsg per accepted socket
Summary: For each `QuicServerTransport` created by `QuicServerWorker`, we are able to set the `cmsg`s to be sent whenever there's a write. With this we can set things like TOS/SO_MARK per connection Reviewed By: bschlinker Differential Revision: D29313608 fbshipit-source-id: d60c97f65681086ae1079b6b95beade95158ec59
This commit is contained in:
committed by
Facebook GitHub Bot
parent
09f96fb162
commit
02c50615a4
@@ -3298,4 +3298,12 @@ void QuicTransportBase::notifyAppRateLimited() {
|
||||
}
|
||||
}
|
||||
|
||||
void QuicTransportBase::setCmsgs(const folly::SocketOptionMap& options) {
|
||||
socket_->setCmsgs(options);
|
||||
}
|
||||
|
||||
void QuicTransportBase::appendCmsgs(const folly::SocketOptionMap& options) {
|
||||
socket_->appendCmsgs(options);
|
||||
}
|
||||
|
||||
} // namespace quic
|
||||
|
@@ -659,6 +659,15 @@ class QuicTransportBase : public QuicSocket {
|
||||
folly::Expected<std::vector<Buf>, LocalErrorCode> readDatagrams(
|
||||
size_t atMost = 0) override;
|
||||
|
||||
/**
|
||||
* Set control messages to be sent for socket_ write, note that it's for this
|
||||
* specific transport and does not change the other sockets sharing the same
|
||||
* fd.
|
||||
*/
|
||||
void setCmsgs(const folly::SocketOptionMap& options);
|
||||
|
||||
void appendCmsgs(const folly::SocketOptionMap& options);
|
||||
|
||||
protected:
|
||||
void updateCongestionControlSettings(
|
||||
const TransportSettings& transportSettings);
|
||||
|
@@ -3845,5 +3845,16 @@ TEST_F(QuicTransportImplTest, DatagramCallbackDatagramAvailable) {
|
||||
transport->driveReadCallbacks();
|
||||
}
|
||||
|
||||
TEST_F(QuicTransportImplTest, Cmsgs) {
|
||||
transport->setServerConnectionId();
|
||||
folly::SocketOptionMap cmsgs;
|
||||
cmsgs[{IPPROTO_IP, IP_TOS}] = 123;
|
||||
EXPECT_CALL(*socketPtr, setCmsgs(_)).Times(1);
|
||||
transport->setCmsgs(cmsgs);
|
||||
|
||||
EXPECT_CALL(*socketPtr, appendCmsgs(_)).Times(1);
|
||||
transport->appendCmsgs(cmsgs);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace quic
|
||||
|
Reference in New Issue
Block a user