Skip to content

Commit

Permalink
fixup: mac build
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneo committed Nov 10, 2024
1 parent f03a81c commit c787781
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/core/lib/event_engine/extensions/system_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#ifndef GRPC_SRC_CORE_LIB_EVENT_ENGINE_EXTENSIONS_SYSTEM_API_H
#define GRPC_SRC_CORE_LIB_EVENT_ENGINE_EXTENSIONS_SYSTEM_API_H

#include <sys/epoll.h>
#include <sys/socket.h>

namespace grpc_event_engine {
Expand All @@ -34,8 +33,6 @@ class FileDescriptor {
int fd_;
};

using EpollEvent = epoll_event;

class SystemApi {
public:
virtual ~SystemApi() = default;
Expand Down
6 changes: 4 additions & 2 deletions src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ namespace experimental {
using ::grpc_event_engine::experimental::EventEngine;
using ::grpc_event_engine::experimental::Poller;

Epoll1Poller::Epoll1Poller(Scheduler* /* engine */) {
Epoll1Poller::Epoll1Poller(Scheduler* /* engine */,
SystemApi* /* system_api */) {
grpc_core::Crash("unimplemented");
}

Expand Down Expand Up @@ -623,7 +624,8 @@ void Epoll1Poller::Kick() { grpc_core::Crash("unimplemented"); }

// If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return
// nullptr.
std::shared_ptr<Epoll1Poller> MakeEpoll1Poller(Scheduler* /*scheduler*/) {
std::shared_ptr<Epoll1Poller> MakeEpoll1Poller(Scheduler* /*scheduler*/,
SystemApi* system_api) {
return nullptr;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void PosixEngineListenerImpl::AsyncConnectionAcceptor::NotifyOnAccept(
}
SystemApi* system_api = handle_->Poller()->GetSystemApi();
PosixSocketWrapper sock(system_api->AdoptExternalFd(fd));
(void)sock.SetSocketNoSigpipeIfPossible();
(void)sock.SetSocketNoSigpipeIfPossible(*system_api);
auto result = sock.ApplySocketMutatorInOptions(
GRPC_FD_SERVER_CONNECTION_USAGE, listener_->options_);
if (!result.ok()) {
Expand Down Expand Up @@ -262,7 +262,7 @@ absl::Status PosixEngineListenerImpl::HandleExternalConnection(
}
SystemApi* system_api = poller_->GetSystemApi();
PosixSocketWrapper sock(system_api->AdoptExternalFd(fd));
(void)sock.SetSocketNoSigpipeIfPossible();
(void)sock.SetSocketNoSigpipeIfPossible(*system_api);
auto peer_name = sock.PeerAddressString(*system_api);
if (!peer_name.ok()) {
return absl::UnknownError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ absl::Status PrepareSocket(const SystemApi& system_api,
GRPC_RETURN_IF_ERROR(socket.sock.SetSocketDscp(system_api, options.dscp));
socket.sock.TrySetSocketTcpUserTimeout(system_api, options, false);
}
GRPC_RETURN_IF_ERROR(socket.sock.SetSocketNoSigpipeIfPossible());
GRPC_RETURN_IF_ERROR(socket.sock.SetSocketNoSigpipeIfPossible(system_api));
GRPC_RETURN_IF_ERROR(socket.sock.ApplySocketMutatorInOptions(
GRPC_FD_SERVER_LISTENER_USAGE, options));

Expand Down
5 changes: 3 additions & 2 deletions src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ absl::Status PrepareTcpClientSocket(const SystemApi& system_api,
GRPC_RETURN_IF_ERROR(sock.SetSocketDscp(system_api, options.dscp));
sock.TrySetSocketTcpUserTimeout(system_api, options, true);
}
GRPC_RETURN_IF_ERROR(sock.SetSocketNoSigpipeIfPossible());
GRPC_RETURN_IF_ERROR(sock.SetSocketNoSigpipeIfPossible(system_api));
GRPC_RETURN_IF_ERROR(sock.ApplySocketMutatorInOptions(
GRPC_FD_CLIENT_CONNECTION_USAGE, options));
// No errors. Set close_fd to false to ensure the socket is not closed.
Expand Down Expand Up @@ -366,7 +366,8 @@ absl::Status PosixSocketWrapper::SetSocketNonBlocking(
return absl::OkStatus();
}

absl::Status PosixSocketWrapper::SetSocketNoSigpipeIfPossible() {
absl::Status PosixSocketWrapper::SetSocketNoSigpipeIfPossible(
const SystemApi& system_api) {
#ifdef GRPC_HAVE_SO_NOSIGPIPE
int val = 1;
int newval;
Expand Down
2 changes: 1 addition & 1 deletion src/core/lib/event_engine/posix_engine/tcp_socket_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class PosixSocketWrapper {

// Tries to set SO_NOSIGPIPE if available on this platform.
// If SO_NO_SIGPIPE is not available, returns not OK status.
absl::Status SetSocketNoSigpipeIfPossible();
absl::Status SetSocketNoSigpipeIfPossible(const SystemApi& system_api);

// Tries to set IP_PKTINFO if available on this platform. If IP_PKTINFO is not
// available, returns not OK status.
Expand Down

0 comments on commit c787781

Please sign in to comment.