Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated fix for refs/heads/ee-test-suite #151

Open
wants to merge 5 commits into
base: ee-test-suite
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanup
  • Loading branch information
Vignesh2208 committed Sep 30, 2022
commit d4273a993f9b0712ddcca54b1d8f6bf7fdfa8bb5
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,17 @@ bool PollStrategyMatches(absl::string_view strategy, absl::string_view want) {
} // namespace

PosixEventPoller* GetDefaultPoller(Scheduler* scheduler) {
static const char* poll_strategy =
GPR_GLOBAL_CONFIG_GET(grpc_poll_strategy).release();
grpc_core::UniquePtr<char> poll_strategy =
GPR_GLOBAL_CONFIG_GET(grpc_poll_strategy);
PosixEventPoller* poller = nullptr;
auto strings = absl::StrSplit(poll_strategy, ',');
auto strings = absl::StrSplit(poll_strategy.get(), ',');
for (auto it = strings.begin(); it != strings.end() && poller == nullptr;
it++) {
if (PollStrategyMatches(*it, "epoll1")) {
poller = GetEpoll1Poller(scheduler);
}
if (poller == nullptr && PollStrategyMatches(*it, "poll")) {
// If epoll1 fails and if poll strategy matches "poll", use Poll poller
} else if (PollStrategyMatches(*it, "poll")) {
poller = GetPollPoller(scheduler, /*use_phony_poll=*/false);
} else if (poller == nullptr && PollStrategyMatches(*it, "none")) {
// If epoll1 fails and if poll strategy matches "none", use phony poll
// poller.
} else if (PollStrategyMatches(*it, "none")) {
poller = GetPollPoller(scheduler, /*use_phony_poll=*/true);
}
}
Expand Down
21 changes: 10 additions & 11 deletions src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "src/core/lib/event_engine/posix_engine/tcp_socket_utils.h"

#include <arpa/inet.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
Expand All @@ -32,7 +33,6 @@
#include "src/core/lib/iomgr/port.h"

#ifdef GRPC_POSIX_SOCKET_UTILS_COMMON
#include <arpa/inet.h> // IWYU pragma: keep
#ifdef GRPC_LINUX_TCP_H
#include <linux/tcp.h>
#else
Expand All @@ -47,7 +47,6 @@
#include <atomic>
#include <cstring>

#include "absl/cleanup/cleanup.h"
#include "absl/status/status.h"
#include "absl/strings/str_format.h"

Expand Down Expand Up @@ -336,8 +335,7 @@ absl::StatusOr<std::string> SockaddrToString(
if (ip != nullptr &&
inet_ntop(addr->sa_family, ip, ntop_buf, sizeof(ntop_buf)) != nullptr) {
if (sin6_scope_id != 0) {
// Enclose sin6_scope_id with the format defined in RFC 6874
// section 2.
// Enclose sin6_scope_id with the format defined in RFC 6874 section 2.
std::string host_with_scope =
absl::StrFormat("%s%%%" PRIu32, ntop_buf, sin6_scope_id);
out = grpc_core::JoinHostPort(host_with_scope, port);
Expand All @@ -348,8 +346,7 @@ absl::StatusOr<std::string> SockaddrToString(
return absl::InvalidArgumentError(
absl::StrCat("Unknown sockaddr family: ", addr->sa_family));
}
// This is probably redundant, but we wouldn't want to log the wrong
// error.
// This is probably redundant, but we wouldn't want to log the wrong error.
errno = save_errno;
return out;
}
Expand Down Expand Up @@ -552,8 +549,8 @@ bool PosixSocketWrapper::IsSocketReusePortSupported() {
int s = socket(AF_INET, SOCK_STREAM, 0);
if (s < 0) {
// This might be an ipv6-only environment in which case
// 'socket(AF_INET,..)' call would fail. Try creating IPv6 socket in
// that case
// 'socket(AF_INET,..)' call would fail. Try creating IPv6 socket in that
// case
s = socket(AF_INET6, SOCK_STREAM, 0);
}
if (s >= 0) {
Expand Down Expand Up @@ -928,15 +925,16 @@ bool PosixSocketWrapper::SetSocketDualStack() {
GPR_ASSERT(false && "unimplemented");
}

bool PosixSocketWrapper::IsSocketReusePortSupported() {
static bool PosixSocketWrapper::IsSocketReusePortSupported() {
GPR_ASSERT(false && "unimplemented");
}

bool PosixSocketWrapper::IsIpv6LoopbackAvailable() {
static bool PosixSocketWrapper::IsIpv6LoopbackAvailable() {
GPR_ASSERT(false && "unimplemented");
}

absl::StatusOr<PosixSocketWrapper> PosixSocketWrapper::CreateDualStackSocket(
static absl::StatusOr<PosixSocketWrapper>
PosixSocketWrapper::CreateDualStackSocket(
std::function<int(int /*domain*/, int /*type*/, int /*protocol*/)>
/* socket_factory */,
const experimental::EventEngine::ResolvedAddress& /*addr*/, int /*type*/,
Expand All @@ -950,6 +948,7 @@ PosixSocketWrapper::CreateAndPrepareTcpClientSocket(
const EventEngine::ResolvedAddress& /*target_addr*/) {
GPR_ASSERT(false && "unimplemented");
}
}

#endif /* GRPC_POSIX_SOCKET_UTILS_COMMON */

Expand Down
2 changes: 2 additions & 0 deletions src/core/lib/event_engine/posix_engine/tcp_socket_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include <grpc/support/port_platform.h>

#include <sys/socket.h>

#include <functional>
#include <string>
#include <utility>
Expand Down