1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-08 09:42:06 +03:00

Remove throws from socket layer

Summary: More in the theme of returning Expected instead of throwing. For the folly case, we keep the try/catches in there and translate to Expected. For Libev, we convert directly to Expected.

Reviewed By: kvtsoy

Differential Revision: D73217128

fbshipit-source-id: d00a978f24e3b29a77a8ac99a19765ae49f64df8
This commit is contained in:
Matt Joras
2025-04-19 15:20:15 -07:00
committed by Facebook GitHub Bot
parent e196f31741
commit 089bf581a7
41 changed files with 2057 additions and 692 deletions

View File

@@ -65,8 +65,10 @@ TEST_F(QuicBatchWriterTest, TestBatchingGSOBase) {
std::make_shared<FollyQuicEventBase>(&evb);
FollyQuicAsyncUDPSocket sock(qEvb);
sock.setReuseAddr(false);
sock.bind(folly::SocketAddress("127.0.0.1", 0));
gsoSupported_ = sock.getGSO() >= 0;
ASSERT_FALSE(sock.bind(folly::SocketAddress("127.0.0.1", 0)).hasError());
auto gsoResult = sock.getGSO();
ASSERT_FALSE(gsoResult.hasError());
gsoSupported_ = gsoResult.value();
auto batchWriter = quic::BatchWriterFactory::makeBatchWriter(
quic::QuicBatchingMode::BATCHING_MODE_GSO,
@@ -95,8 +97,10 @@ TEST_F(QuicBatchWriterTest, TestBatchingGSOLastSmallPacket) {
std::make_shared<FollyQuicEventBase>(&evb);
FollyQuicAsyncUDPSocket sock(qEvb);
sock.setReuseAddr(false);
sock.bind(folly::SocketAddress("127.0.0.1", 0));
gsoSupported_ = sock.getGSO() >= 0;
ASSERT_FALSE(sock.bind(folly::SocketAddress("127.0.0.1", 0)).hasError());
auto gsoResult = sock.getGSO();
ASSERT_FALSE(gsoResult.hasError());
gsoSupported_ = gsoResult.value();
auto batchWriter = quic::BatchWriterFactory::makeBatchWriter(
quic::QuicBatchingMode::BATCHING_MODE_GSO,
@@ -137,8 +141,10 @@ TEST_F(QuicBatchWriterTest, TestBatchingGSOLastBigPacket) {
std::make_shared<FollyQuicEventBase>(&evb);
FollyQuicAsyncUDPSocket sock(qEvb);
sock.setReuseAddr(false);
sock.bind(folly::SocketAddress("127.0.0.1", 0));
gsoSupported_ = sock.getGSO() >= 0;
ASSERT_FALSE(sock.bind(folly::SocketAddress("127.0.0.1", 0)).hasError());
auto gsoResult = sock.getGSO();
ASSERT_FALSE(gsoResult.hasError());
gsoSupported_ = gsoResult.value();
auto batchWriter = quic::BatchWriterFactory::makeBatchWriter(
quic::QuicBatchingMode::BATCHING_MODE_GSO,
@@ -174,8 +180,10 @@ TEST_F(QuicBatchWriterTest, TestBatchingGSOBatchNum) {
std::make_shared<FollyQuicEventBase>(&evb);
FollyQuicAsyncUDPSocket sock(qEvb);
sock.setReuseAddr(false);
sock.bind(folly::SocketAddress("127.0.0.1", 0));
gsoSupported_ = sock.getGSO() >= 0;
ASSERT_FALSE(sock.bind(folly::SocketAddress("127.0.0.1", 0)).hasError());
auto gsoResult = sock.getGSO();
ASSERT_FALSE(gsoResult.hasError());
gsoSupported_ = gsoResult.value();
auto batchWriter = quic::BatchWriterFactory::makeBatchWriter(
quic::QuicBatchingMode::BATCHING_MODE_GSO,
@@ -475,8 +483,10 @@ TEST_F(QuicBatchWriterTest, TestBatchingSendmmsgGSOBatchNum) {
std::make_shared<FollyQuicEventBase>(&evb);
FollyQuicAsyncUDPSocket sock(qEvb);
sock.setReuseAddr(false);
sock.bind(folly::SocketAddress("127.0.0.1", 0));
gsoSupported_ = sock.getGSO() >= 0;
ASSERT_FALSE(sock.bind(folly::SocketAddress("127.0.0.1", 0)).hasError());
auto gsoResult = sock.getGSO();
ASSERT_FALSE(gsoResult.hasError());
gsoSupported_ = gsoResult.value();
auto batchWriter = quic::BatchWriterFactory::makeBatchWriter(
quic::QuicBatchingMode::BATCHING_MODE_SENDMMSG_GSO,
@@ -521,8 +531,10 @@ TEST_F(QuicBatchWriterTest, TestBatchingSendmmsgGSOBatcBigSmallPacket) {
std::make_shared<FollyQuicEventBase>(&evb);
FollyQuicAsyncUDPSocket sock(qEvb);
sock.setReuseAddr(false);
sock.bind(folly::SocketAddress("127.0.0.1", 0));
gsoSupported_ = sock.getGSO() >= 0;
ASSERT_FALSE(sock.bind(folly::SocketAddress("127.0.0.1", 0)).hasError());
auto gsoResult = sock.getGSO();
ASSERT_FALSE(gsoResult.hasError());
gsoSupported_ = gsoResult.value();
auto batchWriter = quic::BatchWriterFactory::makeBatchWriter(
quic::QuicBatchingMode::BATCHING_MODE_SENDMMSG_GSO,