mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-24 04:01:07 +03:00
use the new errnoStr function
Summary: instead of the folly one Reviewed By: sharmafb Differential Revision: D80305359 fbshipit-source-id: 02f4780ed32874e00bcea13b5af4103560d7d205
This commit is contained in:
committed by
Facebook GitHub Bot
parent
14d5724260
commit
5f59ee7eff
@@ -175,6 +175,7 @@ mvfst_cpp_library(
|
||||
"//folly/tracing:static_tracepoint",
|
||||
"//quic/common:buf_accessor",
|
||||
"//quic/common:socket_util",
|
||||
"//quic/common:string_utils",
|
||||
"//quic/happyeyeballs:happyeyeballs",
|
||||
"//quic/state:ack_frequency_functions",
|
||||
"//quic/state:ack_handler",
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
#include <quic/api/IoBufQuicBatch.h>
|
||||
|
||||
#include <quic/common/SocketUtil.h>
|
||||
#include <quic/common/StringUtils.h>
|
||||
#include <quic/happyeyeballs/QuicHappyEyeballsFunctions.h>
|
||||
|
||||
namespace quic {
|
||||
@@ -138,10 +138,10 @@ quic::Expected<bool, QuicError> IOBufQuicBatch::flushInternal() {
|
||||
(happyEyeballsState_ && !happyEyeballsState_->shouldWriteToFirstSocket &&
|
||||
!happyEyeballsState_->shouldWriteToSecondSocket)) {
|
||||
auto firstSocketErrorMsg = firstSocketErrno.has_value()
|
||||
? fmt::format("{}, ", folly::errnoStr(firstSocketErrno.value()))
|
||||
? fmt::format("{}, ", quic::errnoStr(firstSocketErrno.value()))
|
||||
: "";
|
||||
auto secondSocketErrorMsg = secondSocketErrno.has_value()
|
||||
? folly::errnoStr(secondSocketErrno.value())
|
||||
? quic::errnoStr(secondSocketErrno.value())
|
||||
: "";
|
||||
auto errorMsg =
|
||||
fmt::format("{}{}", firstSocketErrorMsg, secondSocketErrorMsg);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <quic/codec/QuicWriteCodec.h>
|
||||
#include <quic/codec/Types.h>
|
||||
#include <quic/common/BufAccessor.h>
|
||||
#include <quic/common/StringUtils.h>
|
||||
#include <quic/flowcontrol/QuicFlowController.h>
|
||||
#include <quic/happyeyeballs/QuicHappyEyeballsFunctions.h>
|
||||
|
||||
@@ -1508,8 +1509,8 @@ void writeCloseCommon(
|
||||
auto ret = sock.write(connection.peerAddress, vec, iovec_len);
|
||||
connection.lossState.totalBytesSent += packetSize;
|
||||
if (ret < 0) {
|
||||
VLOG(4) << "Error writing connection close " << folly::errnoStr(errno)
|
||||
<< " " << connection;
|
||||
VLOG(4) << "Error writing connection close " << quic::errnoStr(errno) << " "
|
||||
<< connection;
|
||||
} else {
|
||||
QUIC_STATS(connection.statsCallback, onWrite, ret);
|
||||
}
|
||||
|
||||
@@ -1314,7 +1314,7 @@ void QuicClientTransportLite::errMessage(
|
||||
|
||||
const struct sock_extended_err* serr =
|
||||
reinterpret_cast<const struct sock_extended_err*>(CMSG_DATA(&cmsg));
|
||||
auto errStr = folly::errnoStr(serr->ee_errno);
|
||||
auto errStr = quic::errnoStr(serr->ee_errno);
|
||||
if (!happyEyeballsState.shouldWriteToFirstSocket &&
|
||||
!happyEyeballsState.shouldWriteToSecondSocket) {
|
||||
asyncClose(QuicError(
|
||||
@@ -1456,7 +1456,7 @@ quic::Expected<void, QuicError> QuicClientTransportLite::recvMsg(
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(LocalErrorCode::CONNECTION_ABANDONED),
|
||||
fmt::format(
|
||||
"recvmsg() failed, errno={} {}", errno, folly::errnoStr(errno))));
|
||||
"recvmsg() failed, errno={} {}", errno, quic::errnoStr(errno))));
|
||||
} else if (ret == 0) {
|
||||
break;
|
||||
}
|
||||
@@ -1632,7 +1632,7 @@ quic::Expected<void, QuicError> QuicClientTransportLite::recvMmsg(
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
fmt::format(
|
||||
"recvmmsg() failed, errno={} {}", errno, folly::errnoStr(errno))));
|
||||
"recvmmsg() failed, errno={} {}", errno, quic::errnoStr(errno))));
|
||||
}
|
||||
|
||||
CHECK_LE(numMsgsRecvd, numPackets);
|
||||
|
||||
@@ -78,7 +78,6 @@ mvfst_cpp_test(
|
||||
"TypesTest.cpp",
|
||||
],
|
||||
deps = [
|
||||
"//folly:string",
|
||||
"//folly/container:array",
|
||||
"//folly/io:iobuf",
|
||||
"//folly/portability:gtest",
|
||||
@@ -192,7 +191,6 @@ mvfst_cpp_test(
|
||||
supports_static_listing = False,
|
||||
deps = [
|
||||
"//folly:expected",
|
||||
"//folly:string",
|
||||
"//folly/io:iobuf",
|
||||
"//folly/portability:gtest",
|
||||
"//quic:exception",
|
||||
|
||||
@@ -51,7 +51,6 @@ mvfst_cpp_test(
|
||||
"BufUtilTest.cpp",
|
||||
],
|
||||
deps = [
|
||||
"//folly:string",
|
||||
"//folly/io:iobuf",
|
||||
"//quic/common:buf_accessor",
|
||||
"//quic/common:buf_util",
|
||||
@@ -65,7 +64,6 @@ mvfst_cpp_test(
|
||||
"ChainedByteRangeTest.cpp",
|
||||
],
|
||||
deps = [
|
||||
"//folly:string",
|
||||
"//folly/io:iobuf",
|
||||
"//quic/common:buf_util",
|
||||
],
|
||||
|
||||
@@ -17,7 +17,6 @@ mvfst_cpp_library(
|
||||
"//folly/io:iobuf",
|
||||
"//folly/io:socket_option_map",
|
||||
"//folly/io/async:async_socket_exception",
|
||||
"//folly/lang:exception",
|
||||
"//folly/portability:sockets",
|
||||
"//quic:exception",
|
||||
"//quic/common:expected",
|
||||
@@ -37,8 +36,8 @@ mvfst_cpp_library(
|
||||
],
|
||||
deps = [
|
||||
"//folly:likely",
|
||||
"//folly:string",
|
||||
"//quic:exception",
|
||||
"//quic/common:string_utils",
|
||||
],
|
||||
exported_deps = [
|
||||
":quic_async_udp_socket",
|
||||
@@ -54,10 +53,9 @@ mvfst_cpp_library(
|
||||
"FollyQuicAsyncUDPSocket.h",
|
||||
],
|
||||
deps = [
|
||||
"//folly:string",
|
||||
"//folly/io/async:async_socket_exception",
|
||||
"//folly/lang:exception",
|
||||
"//quic:exception",
|
||||
"//quic/common:string_utils",
|
||||
],
|
||||
exported_deps = [
|
||||
":quic_async_udp_socket_impl",
|
||||
@@ -79,9 +77,8 @@ mvfst_cpp_library(
|
||||
],
|
||||
labels = ci.labels(ci.remove(ci.windows())),
|
||||
deps = [
|
||||
"//folly:string",
|
||||
"//folly/lang:exception",
|
||||
"//quic/common:optional",
|
||||
"//quic/common:string_utils",
|
||||
],
|
||||
exported_deps = [
|
||||
":quic_async_udp_socket_impl",
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
*/
|
||||
|
||||
#include <errno.h> // For errno
|
||||
#include <folly/String.h>
|
||||
#include <folly/io/async/AsyncSocketException.h>
|
||||
#include <folly/lang/Exception.h> // For folly::errnoStr
|
||||
#include <quic/QuicException.h> // For QuicError, QuicErrorCode, TransportErrorCode
|
||||
#include <quic/common/Expected.h>
|
||||
#include <quic/common/StringUtils.h>
|
||||
#include <quic/common/udpsocket/FollyQuicAsyncUDPSocket.h>
|
||||
#include <memory>
|
||||
|
||||
@@ -23,7 +22,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::init(
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly init failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -39,7 +38,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::bind(
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly bind failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -59,7 +58,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::connect(
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly connect failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -76,7 +75,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::close() {
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly close failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -121,7 +120,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setErrMessageCallback(
|
||||
std::string errorMsg =
|
||||
"Folly setErrMessageCallback failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -256,7 +255,7 @@ quic::Expected<int, QuicError> FollyQuicAsyncUDPSocket::getGSO() {
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly getGSO failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
LOG(ERROR) << "getGSO failed: " << errorMsg;
|
||||
return quic::make_unexpected(QuicError(
|
||||
@@ -271,7 +270,7 @@ quic::Expected<int, QuicError> FollyQuicAsyncUDPSocket::getGRO() {
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly getGRO failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -288,7 +287,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setGRO(bool bVal) {
|
||||
int errnoCopy = errno; // Capture errno immediately after failure
|
||||
std::string errorMsg = "Folly setGRO failed";
|
||||
if (errnoCopy != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(errnoCopy);
|
||||
errorMsg += ": " + quic::errnoStr(errnoCopy);
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -298,7 +297,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setGRO(bool bVal) {
|
||||
// Catch just in case future folly versions throw
|
||||
std::string errorMsg = "Folly setGRO exception: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -314,7 +313,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setRecvTos(
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly setRecvTos failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -328,7 +327,7 @@ quic::Expected<bool, QuicError> FollyQuicAsyncUDPSocket::getRecvTos() {
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly getRecvTos failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -345,7 +344,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setTosOrTrafficClass(
|
||||
std::string errorMsg =
|
||||
"Folly setTosOrTrafficClass failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -360,7 +359,7 @@ FollyQuicAsyncUDPSocket::address() const {
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly address() failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -375,7 +374,7 @@ FollyQuicAsyncUDPSocket::address() const {
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly address() failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
LOG(FATAL) << errorMsg;
|
||||
}
|
||||
@@ -413,7 +412,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setCmsgs(
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly setCmsgs failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -430,7 +429,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::appendCmsgs(
|
||||
std::string errorMsg =
|
||||
"Folly appendCmsgs failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -461,7 +460,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setAdditionalCmsgsFunc(
|
||||
std::string errorMsg =
|
||||
"Folly setAdditionalCmsgsFunc failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -476,7 +475,7 @@ quic::Expected<int, QuicError> FollyQuicAsyncUDPSocket::getTimestamping() {
|
||||
std::string errorMsg =
|
||||
"Folly getTimestamping failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -493,7 +492,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setReuseAddr(
|
||||
std::string errorMsg =
|
||||
"Folly setReuseAddr failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -509,7 +508,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setDFAndTurnOffPMTU() {
|
||||
std::string errorMsg =
|
||||
"Folly setDFAndTurnOffPMTU failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -527,7 +526,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::applyOptions(
|
||||
std::string errorMsg =
|
||||
"Folly applyOptions failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -544,7 +543,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setReusePort(
|
||||
std::string errorMsg =
|
||||
"Folly setReusePort failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -559,7 +558,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setRcvBuf(int rcvBuf) {
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly setRcvBuf failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -574,7 +573,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setSndBuf(int sndBuf) {
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly setSndBuf failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -600,7 +599,7 @@ quic::Expected<void, QuicError> FollyQuicAsyncUDPSocket::setFD(
|
||||
} catch (const folly::AsyncSocketException& ex) {
|
||||
std::string errorMsg = "Folly setFD failed: " + std::string(ex.what());
|
||||
if (ex.getErrno() != 0) {
|
||||
errorMsg += ": " + folly::errnoStr(ex.getErrno());
|
||||
errorMsg += ": " + quic::errnoStr(ex.getErrno());
|
||||
}
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
|
||||
@@ -5,11 +5,10 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#include <folly/String.h>
|
||||
#include <folly/lang/Exception.h> // For folly::errnoStr
|
||||
#include <quic/QuicException.h> // For QuicError, QuicErrorCode, TransportErrorCode
|
||||
#include <quic/common/Expected.h>
|
||||
#include <quic/common/Optional.h>
|
||||
#include <quic/common/StringUtils.h>
|
||||
#include <quic/common/udpsocket/LibevQuicAsyncUDPSocket.h>
|
||||
|
||||
#include <cstring>
|
||||
@@ -195,7 +194,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::close() {
|
||||
int errnoCopy = errno;
|
||||
fd_ = -1; // Mark as closed even if error occurred
|
||||
std::string errorMsg =
|
||||
"Failed to close socket: " + folly::errnoStr(errnoCopy);
|
||||
"Failed to close socket: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -243,7 +242,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::init(
|
||||
if (fd == -1) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"error creating socket: " + folly::errnoStr(errnoCopy);
|
||||
"error creating socket: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -256,7 +255,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::init(
|
||||
if (flags == -1) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"error getting socket flags: " + folly::errnoStr(errnoCopy);
|
||||
"error getting socket flags: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -264,7 +263,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::init(
|
||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) != 0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"error setting socket nonblocking flag: " + folly::errnoStr(errnoCopy);
|
||||
"error setting socket nonblocking flag: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -276,7 +275,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::init(
|
||||
fd, SOL_SOCKET, SO_REUSEADDR, &sockOptVal, sizeof(sockOptVal)) != 0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"error setting reuse address on socket: " + folly::errnoStr(errnoCopy);
|
||||
"error setting reuse address on socket: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -286,7 +285,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::init(
|
||||
fd, SOL_SOCKET, SO_REUSEPORT, &sockOptVal, sizeof(sockOptVal)) != 0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"error setting reuse port on socket: " + folly::errnoStr(errnoCopy);
|
||||
"error setting reuse port on socket: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -297,8 +296,8 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::init(
|
||||
int value = rcvBuf_;
|
||||
if (::setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &value, sizeof(value)) != 0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg = "failed to set SO_RCVBUF on the socket: " +
|
||||
folly::errnoStr(errnoCopy);
|
||||
std::string errorMsg =
|
||||
"failed to set SO_RCVBUF on the socket: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -310,8 +309,8 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::init(
|
||||
int value = sndBuf_;
|
||||
if (::setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &value, sizeof(value)) != 0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg = "failed to set SO_SNDBUF on the socket: " +
|
||||
folly::errnoStr(errnoCopy);
|
||||
std::string errorMsg =
|
||||
"failed to set SO_SNDBUF on the socket: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -352,7 +351,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::bind(
|
||||
: sizeof(sockaddr_in)) != 0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg = "error binding socket to " + address.describe() +
|
||||
": " + folly::errnoStr(errnoCopy);
|
||||
": " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -363,7 +362,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::bind(
|
||||
if (::getsockname(fd_, &saddr, &len) != 0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"error retrieving local address: " + folly::errnoStr(errnoCopy);
|
||||
"error retrieving local address: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -393,7 +392,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::connect(
|
||||
address.getActualSize()) != 0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg = "Libev connect failed to " + address.describe();
|
||||
errorMsg += ": " + folly::errnoStr(errnoCopy);
|
||||
errorMsg += ": " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -410,7 +409,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::connect(
|
||||
0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg = "Libev getsockname failed after connect: " +
|
||||
folly::errnoStr(errnoCopy);
|
||||
quic::errnoStr(errnoCopy);
|
||||
// Connect succeeded, but getsockname failed.
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
@@ -452,7 +451,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::setDFAndTurnOffPMTU() {
|
||||
if (::setsockopt(fd_, IPPROTO_IP, optname4, &optval4, sizeof(optval4))) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg = "failed to turn off PMTU discovery (IPv4): " +
|
||||
folly::errnoStr(errnoCopy);
|
||||
quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -462,7 +461,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::setDFAndTurnOffPMTU() {
|
||||
if (::setsockopt(fd_, IPPROTO_IPV6, optname6, &optval6, sizeof(optval6))) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg = "failed to turn off PMTU discovery (IPv6): " +
|
||||
folly::errnoStr(errnoCopy);
|
||||
quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -500,7 +499,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::setErrMessageCallback(
|
||||
::setsockopt(fd_, IPPROTO_IP, optname4, &err, sizeof(err))) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"Failed to set IP_RECVERR: " + folly::errnoStr(errnoCopy);
|
||||
"Failed to set IP_RECVERR: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -509,7 +508,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::setErrMessageCallback(
|
||||
::setsockopt(fd_, IPPROTO_IPV6, optname6, &err, sizeof(err))) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"Failed to set IPV6_RECVERR: " + folly::errnoStr(errnoCopy);
|
||||
"Failed to set IPV6_RECVERR: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -579,7 +578,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::applyOptions(
|
||||
sizeof(opt.second)) != 0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"failed to apply socket options: " + folly::errnoStr(errnoCopy);
|
||||
"failed to apply socket options: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -768,7 +767,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::setRcvBuf(int rcvBuf) {
|
||||
if (::setsockopt(fd_, SOL_SOCKET, SO_RCVBUF, &value, sizeof(value)) != 0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"failed to set SO_RCVBUF: " + folly::errnoStr(errnoCopy);
|
||||
"failed to set SO_RCVBUF: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -785,7 +784,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::setSndBuf(int sndBuf) {
|
||||
if (::setsockopt(fd_, SOL_SOCKET, SO_SNDBUF, &value, sizeof(value)) != 0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"failed to set SO_SNDBUF: " + folly::errnoStr(errnoCopy);
|
||||
"failed to set SO_SNDBUF: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
@@ -804,7 +803,7 @@ quic::Expected<void, QuicError> LibevQuicAsyncUDPSocket::setReuseAddr(
|
||||
0) {
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg =
|
||||
"failed to set SO_REUSEADDR: " + folly::errnoStr(errnoCopy);
|
||||
"failed to set SO_REUSEADDR: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <folly/io/IOBuf.h>
|
||||
#include <folly/io/SocketOptionMap.h>
|
||||
#include <folly/io/async/AsyncSocketException.h>
|
||||
#include <folly/lang/Exception.h> // For folly::errnoStr
|
||||
#include <folly/portability/Sockets.h>
|
||||
#include <quic/common/Expected.h>
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
#include <folly/Likely.h>
|
||||
#include <folly/String.h>
|
||||
#include <quic/QuicException.h> // For QuicError, QuicErrorCode, TransportErrorCode
|
||||
#include <quic/common/StringUtils.h>
|
||||
#include <quic/common/udpsocket/QuicAsyncUDPSocketImpl.h>
|
||||
|
||||
namespace {
|
||||
@@ -104,7 +104,7 @@ QuicAsyncUDPSocketImpl::recvmmsgNetworkData(
|
||||
pauseRead();
|
||||
// Return the error from recvmmsg itself
|
||||
int errnoCopy = errno;
|
||||
std::string errorMsg = "recvmmsg failed: " + folly::errnoStr(errnoCopy);
|
||||
std::string errorMsg = "recvmmsg failed: " + quic::errnoStr(errnoCopy);
|
||||
return quic::make_unexpected(QuicError(
|
||||
QuicErrorCode(TransportErrorCode::INTERNAL_ERROR),
|
||||
std::move(errorMsg)));
|
||||
|
||||
@@ -40,7 +40,6 @@ mvfst_cpp_test(
|
||||
supports_static_listing = False,
|
||||
deps = [
|
||||
"//fizz/record:record",
|
||||
"//folly:string",
|
||||
"//folly/portability:gtest",
|
||||
"//quic/common:string_utils",
|
||||
"//quic/fizz/handshake:fizz_handshake",
|
||||
|
||||
@@ -52,7 +52,7 @@ mvfst_cpp_library(
|
||||
],
|
||||
deps = [
|
||||
"//folly:benchmark",
|
||||
"//folly:string",
|
||||
"//quic/common:string_utils",
|
||||
],
|
||||
exported_deps = [
|
||||
":xsk_lib",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#if defined(__linux__) && !defined(ANDROID)
|
||||
|
||||
#include <folly/Benchmark.h>
|
||||
#include <folly/String.h>
|
||||
#include <quic/common/StringUtils.h>
|
||||
#include <quic/xsk/XskSender.h>
|
||||
#include <quic/xsk/packet_utils.h>
|
||||
#include <stdexcept>
|
||||
@@ -215,7 +215,7 @@ quic::Expected<void, std::runtime_error> XskSender::bind(int queueId) {
|
||||
}
|
||||
if (bind_result < 0) {
|
||||
std::string errorMsg =
|
||||
fmt::format("Failed to bind xdp socket: {}", folly::errnoStr(errno));
|
||||
fmt::format("Failed to bind xdp socket: {}", quic::errnoStr(errno));
|
||||
return quic::make_unexpected(std::runtime_error(errorMsg));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user