Skip to content

Commit

Permalink
libuv replace epoll and macos inspired by benbenz
Browse files Browse the repository at this point in the history
  • Loading branch information
martenrichter committed Mar 12, 2022
1 parent 71ca31b commit 52a462c
Show file tree
Hide file tree
Showing 9 changed files with 1,921 additions and 24 deletions.
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project (webtransport)


set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)

set(BUILD_TESTING OFF)

Expand Down Expand Up @@ -69,6 +69,8 @@ platform/net/quic/platform/impl/quic_server_stats_impl.h
platform/net/quic/platform/impl/quic_stack_trace_impl.h
platform/net/quic/platform/impl/quic_epoll_clock.h
platform/net/quic/platform/impl/quic_epoll_clock.cc
platform/net/quic/platform/impl/simple_libuv_epoll_server.cc
platform/net/quic/platform/impl/simple_libuv_epoll_server.h
#protofiles
#${PROTO_SRCS}
#${CMAKE_CURRENT_BINARY_DIR}/third_party/quiche/quic/core/proto/cached_network_parameters.pb.h
Expand Down Expand Up @@ -791,9 +793,11 @@ set_property(TARGET gquiche PROPERTY CXX_STANDARD 17)
target_include_directories(gquiche
PUBLIC third_party/quiche
PUBLIC third_party/boringssl/src/include
PUBLIC third_party/abseil-cpp
PUBLIC platform
PUBLIC .
PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
PUBLIC ${CMAKE_JS_INC}
)
target_link_libraries(gquiche
absl::base
Expand All @@ -806,6 +810,10 @@ absl::synchronization
protobuf
ssl crypto)

if(APPLE)
target_compile_definitions (gquiche PRIVATE __APPLE_USE_RFC_3542)
endif()


# google quiche build parameters end

Expand All @@ -830,7 +838,7 @@ target_include_directories(${PROJECT_NAME}
PRIVATE ${NODE_ADDON_API_DIR})


add_definitions(-DNAPI_VERSION=3)
#add_definitions(-DNAPI_VERSION=3)



Expand Down
4 changes: 2 additions & 2 deletions platform/net/quic/platform/impl/quic_epoll_clock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/quic/platform/impl/quic_epoll_clock.h"
#include "epoll_server/simple_epoll_server.h"
#include "net/quic/platform/impl/simple_libuv_epoll_server.h"
#include "quic/platform/api/quic_flag_utils.h"
#include "quic/platform/api/quic_flags.h"
namespace quic {
QuicEpollClock::QuicEpollClock(epoll_server::SimpleEpollServer* epoll_server)
QuicEpollClock::QuicEpollClock(QuicEpollServerImpl* epoll_server)
: epoll_server_(epoll_server), largest_time_(QuicTime::Zero()) {}
QuicEpollClock::~QuicEpollClock() {}
QuicTime QuicEpollClock::ApproximateNow() const {
Expand Down
10 changes: 5 additions & 5 deletions platform/net/quic/platform/impl/quic_epoll_clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
// #include "base/compiler_specific.h"
#include "quic/core/quic_clock.h"
#include "quic/core/quic_time.h"
namespace epoll_server {
class SimpleEpollServer;
} // namespace epoll_server
#include "net/quic/platform/impl/quic_epoll_impl.h"


namespace quic {
// Clock to efficiently retrieve an approximately accurate time from an
// net::EpollServer.
class QuicEpollClock : public QuicClock {
public:
explicit QuicEpollClock(epoll_server::SimpleEpollServer* epoll_server);
explicit QuicEpollClock(QuicEpollServerImpl* epoll_server);
QuicEpollClock(const QuicEpollClock&) = delete;
QuicEpollClock& operator=(const QuicEpollClock&) = delete;
~QuicEpollClock() override;
Expand All @@ -31,7 +31,7 @@ class QuicEpollClock : public QuicClock {
QuicTime ConvertWallTimeToQuicTime(
const QuicWallTime& walltime) const override;
protected:
epoll_server::SimpleEpollServer* epoll_server_;
QuicEpollServerImpl* epoll_server_;
// Largest time returned from Now() so far.
mutable QuicTime largest_time_;
};
Expand Down
10 changes: 5 additions & 5 deletions platform/net/quic/platform/impl/quic_epoll_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
#ifndef NET_QUIC_PLATFORM_IMPL_QUIC_EPOLL_IMPL_H_
#define NET_QUIC_PLATFORM_IMPL_QUIC_EPOLL_IMPL_H_

#include "epoll_server/simple_epoll_server.h"
#include "net/quic/platform/impl/simple_libuv_epoll_server.h"

namespace quic {

using QuicEpollServerImpl = epoll_server::SimpleEpollServer;
using QuicEpollEventImpl = epoll_server::EpollEvent;
using QuicEpollAlarmBaseImpl = epoll_server::EpollAlarm;
using QuicEpollCallbackInterfaceImpl = epoll_server::EpollCallbackInterface;
using QuicEpollServerImpl = epoll_server::SimpleLibuvEpollServer;
using QuicEpollEventImpl = epoll_server::LibuvEpollEvent;
using QuicEpollAlarmBaseImpl = epoll_server::LibuvEpollAlarm;
using QuicEpollCallbackInterfaceImpl = epoll_server::LibuvEpollCallbackInterface;

} // namespace quic

Expand Down
2 changes: 1 addition & 1 deletion platform/net/quic/platform/impl/quic_iovec_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct iovec {
void* iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};
#elif defined(linux)
#elif defined(linux) || defined(__APPLE__)
#include <sys/uio.h>
#endif // defined(OS_WIN)

Expand Down
Loading

0 comments on commit 52a462c

Please sign in to comment.