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