gfe-relnote: Add QuicUdpSocketApi, a de-platformized version of QuicSocketUtils, and use it in some non-production code. No behavior change, not protected.
This is the first step to kill quic_socket_utils.(h|cc).
Chromium merge notes:
1) The platform impl function, GetGooglePacketHeadersFromControlMessageImpl, can simply return false.
2) Please add quic/core/quic_udp_socket* to "epoll_quic_tools" in BUILD.gn: http://shortn/_zpf4caOcsa
PiperOrigin-RevId: 289439832
Change-Id: I3bf2d1f21314bcfb2c3a72f74fab25a22d49d49d
diff --git a/quic/tools/quic_server.cc b/quic/tools/quic_server.cc
index 04cc950..ef31d86 100644
--- a/quic/tools/quic_server.cc
+++ b/quic/tools/quic_server.cc
@@ -28,15 +28,10 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/quic/platform/impl/quic_epoll_clock.h"
-#include "net/quic/platform/impl/quic_socket_utils.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_crypto_server_stream_helper.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_dispatcher.h"
#include "net/third_party/quiche/src/quic/tools/quic_simple_server_backend.h"
-#ifndef SO_RXQ_OVFL
-#define SO_RXQ_OVFL 40
-#endif
-
namespace quic {
namespace {
@@ -118,15 +113,18 @@
QuicServer::~QuicServer() = default;
bool QuicServer::CreateUDPSocketAndListen(const QuicSocketAddress& address) {
- fd_ = QuicSocketUtils::CreateUDPSocket(
- address,
- /*receive_buffer_size =*/kDefaultSocketReceiveBuffer,
- /*send_buffer_size =*/kDefaultSocketReceiveBuffer, &overflow_supported_);
- if (fd_ < 0) {
+ QuicUdpSocketApi socket_api;
+ fd_ = socket_api.Create(address.host().AddressFamilyToInt(),
+ /*receive_buffer_size =*/kDefaultSocketReceiveBuffer,
+ /*send_buffer_size =*/kDefaultSocketReceiveBuffer);
+ if (fd_ == kQuicInvalidSocketFd) {
QUIC_LOG(ERROR) << "CreateSocket() failed: " << strerror(errno);
return false;
}
+ overflow_supported_ = socket_api.EnableDroppedPacketCount(fd_);
+ socket_api.EnableReceiveTimestamp(fd_);
+
sockaddr_storage addr = address.generic_address();
int rc = bind(fd_, reinterpret_cast<sockaddr*>(&addr), sizeof(addr));
if (rc < 0) {