diff --git a/BUILD b/BUILD
index d2a4e70f614..bad6f3f0755 100644
--- a/BUILD
+++ b/BUILD
@@ -366,7 +366,6 @@ cc_library(
"src/core/lib/iomgr/socket_utils_common_posix.c",
"src/core/lib/iomgr/socket_utils_linux.c",
"src/core/lib/iomgr/socket_utils_posix.c",
- "src/core/lib/iomgr/socket_utils_tos_posix.c",
"src/core/lib/iomgr/socket_windows.c",
"src/core/lib/iomgr/tcp_client_posix.c",
"src/core/lib/iomgr/tcp_client_windows.c",
@@ -753,7 +752,6 @@ cc_library(
"src/core/lib/iomgr/socket_utils_common_posix.c",
"src/core/lib/iomgr/socket_utils_linux.c",
"src/core/lib/iomgr/socket_utils_posix.c",
- "src/core/lib/iomgr/socket_utils_tos_posix.c",
"src/core/lib/iomgr/socket_windows.c",
"src/core/lib/iomgr/tcp_client_posix.c",
"src/core/lib/iomgr/tcp_client_windows.c",
@@ -1102,7 +1100,6 @@ cc_library(
"src/core/lib/iomgr/socket_utils_common_posix.c",
"src/core/lib/iomgr/socket_utils_linux.c",
"src/core/lib/iomgr/socket_utils_posix.c",
- "src/core/lib/iomgr/socket_utils_tos_posix.c",
"src/core/lib/iomgr/socket_windows.c",
"src/core/lib/iomgr/tcp_client_posix.c",
"src/core/lib/iomgr/tcp_client_windows.c",
@@ -1866,7 +1863,6 @@ objc_library(
"src/core/lib/iomgr/socket_utils_common_posix.c",
"src/core/lib/iomgr/socket_utils_linux.c",
"src/core/lib/iomgr/socket_utils_posix.c",
- "src/core/lib/iomgr/socket_utils_tos_posix.c",
"src/core/lib/iomgr/socket_windows.c",
"src/core/lib/iomgr/tcp_client_posix.c",
"src/core/lib/iomgr/tcp_client_windows.c",
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d88d9177524..c4191521bd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -333,7 +333,6 @@ add_library(grpc
src/core/lib/iomgr/socket_utils_common_posix.c
src/core/lib/iomgr/socket_utils_linux.c
src/core/lib/iomgr/socket_utils_posix.c
- src/core/lib/iomgr/socket_utils_tos_posix.c
src/core/lib/iomgr/socket_windows.c
src/core/lib/iomgr/tcp_client_posix.c
src/core/lib/iomgr/tcp_client_windows.c
@@ -593,7 +592,6 @@ add_library(grpc_cronet
src/core/lib/iomgr/socket_utils_common_posix.c
src/core/lib/iomgr/socket_utils_linux.c
src/core/lib/iomgr/socket_utils_posix.c
- src/core/lib/iomgr/socket_utils_tos_posix.c
src/core/lib/iomgr/socket_windows.c
src/core/lib/iomgr/tcp_client_posix.c
src/core/lib/iomgr/tcp_client_windows.c
@@ -825,7 +823,6 @@ add_library(grpc_unsecure
src/core/lib/iomgr/socket_utils_common_posix.c
src/core/lib/iomgr/socket_utils_linux.c
src/core/lib/iomgr/socket_utils_posix.c
- src/core/lib/iomgr/socket_utils_tos_posix.c
src/core/lib/iomgr/socket_windows.c
src/core/lib/iomgr/tcp_client_posix.c
src/core/lib/iomgr/tcp_client_windows.c
diff --git a/Makefile b/Makefile
index cd988b85557..62c65822b0f 100644
--- a/Makefile
+++ b/Makefile
@@ -1012,7 +1012,6 @@ set_initial_connect_string_test: $(BINDIR)/$(CONFIG)/set_initial_connect_string_
sockaddr_resolver_test: $(BINDIR)/$(CONFIG)/sockaddr_resolver_test
sockaddr_utils_test: $(BINDIR)/$(CONFIG)/sockaddr_utils_test
socket_utils_test: $(BINDIR)/$(CONFIG)/socket_utils_test
-socket_utils_tos_test: $(BINDIR)/$(CONFIG)/socket_utils_tos_test
tcp_client_posix_test: $(BINDIR)/$(CONFIG)/tcp_client_posix_test
tcp_posix_test: $(BINDIR)/$(CONFIG)/tcp_posix_test
tcp_server_posix_test: $(BINDIR)/$(CONFIG)/tcp_server_posix_test
@@ -1329,7 +1328,6 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/sockaddr_resolver_test \
$(BINDIR)/$(CONFIG)/sockaddr_utils_test \
$(BINDIR)/$(CONFIG)/socket_utils_test \
- $(BINDIR)/$(CONFIG)/socket_utils_tos_test \
$(BINDIR)/$(CONFIG)/tcp_client_posix_test \
$(BINDIR)/$(CONFIG)/tcp_posix_test \
$(BINDIR)/$(CONFIG)/tcp_server_posix_test \
@@ -1716,8 +1714,6 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/sockaddr_utils_test || ( echo test sockaddr_utils_test failed ; exit 1 )
$(E) "[RUN] Testing socket_utils_test"
$(Q) $(BINDIR)/$(CONFIG)/socket_utils_test || ( echo test socket_utils_test failed ; exit 1 )
- $(E) "[RUN] Testing socket_utils_tos_test"
- $(Q) $(BINDIR)/$(CONFIG)/socket_utils_tos_test || ( echo test socket_utils_tos_test failed ; exit 1 )
$(E) "[RUN] Testing tcp_client_posix_test"
$(Q) $(BINDIR)/$(CONFIG)/tcp_client_posix_test || ( echo test tcp_client_posix_test failed ; exit 1 )
$(E) "[RUN] Testing tcp_posix_test"
@@ -2581,7 +2577,6 @@ LIBGRPC_SRC = \
src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \
src/core/lib/iomgr/socket_utils_posix.c \
- src/core/lib/iomgr/socket_utils_tos_posix.c \
src/core/lib/iomgr/socket_windows.c \
src/core/lib/iomgr/tcp_client_posix.c \
src/core/lib/iomgr/tcp_client_windows.c \
@@ -2859,7 +2854,6 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \
src/core/lib/iomgr/socket_utils_posix.c \
- src/core/lib/iomgr/socket_utils_tos_posix.c \
src/core/lib/iomgr/socket_windows.c \
src/core/lib/iomgr/tcp_client_posix.c \
src/core/lib/iomgr/tcp_client_windows.c \
@@ -3127,7 +3121,6 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \
src/core/lib/iomgr/socket_utils_posix.c \
- src/core/lib/iomgr/socket_utils_tos_posix.c \
src/core/lib/iomgr/socket_windows.c \
src/core/lib/iomgr/tcp_client_posix.c \
src/core/lib/iomgr/tcp_client_windows.c \
@@ -3322,7 +3315,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \
src/core/lib/iomgr/socket_utils_posix.c \
- src/core/lib/iomgr/socket_utils_tos_posix.c \
src/core/lib/iomgr/socket_windows.c \
src/core/lib/iomgr/tcp_client_posix.c \
src/core/lib/iomgr/tcp_client_windows.c \
@@ -10349,38 +10341,6 @@ endif
endif
-SOCKET_UTILS_TOS_TEST_SRC = \
- test/core/iomgr/socket_utils_tos_test.c \
-
-SOCKET_UTILS_TOS_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(SOCKET_UTILS_TOS_TEST_SRC))))
-ifeq ($(NO_SECURE),true)
-
-# You can't build secure targets if you don't have OpenSSL.
-
-$(BINDIR)/$(CONFIG)/socket_utils_tos_test: openssl_dep_error
-
-else
-
-
-
-$(BINDIR)/$(CONFIG)/socket_utils_tos_test: $(SOCKET_UTILS_TOS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
- $(E) "[LD] Linking $@"
- $(Q) mkdir -p `dirname $@`
- $(Q) $(LD) $(LDFLAGS) $(SOCKET_UTILS_TOS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/socket_utils_tos_test
-
-endif
-
-$(OBJDIR)/$(CONFIG)/test/core/iomgr/socket_utils_tos_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-
-deps_socket_utils_tos_test: $(SOCKET_UTILS_TOS_TEST_OBJS:.o=.dep)
-
-ifneq ($(NO_SECURE),true)
-ifneq ($(NO_DEPS),true)
--include $(SOCKET_UTILS_TOS_TEST_OBJS:.o=.dep)
-endif
-endif
-
-
TCP_CLIENT_POSIX_TEST_SRC = \
test/core/iomgr/tcp_client_posix_test.c \
diff --git a/binding.gyp b/binding.gyp
index fd2bed86b04..58edda2e63e 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -608,7 +608,6 @@
'src/core/lib/iomgr/socket_utils_common_posix.c',
'src/core/lib/iomgr/socket_utils_linux.c',
'src/core/lib/iomgr/socket_utils_posix.c',
- 'src/core/lib/iomgr/socket_utils_tos_posix.c',
'src/core/lib/iomgr/socket_windows.c',
'src/core/lib/iomgr/tcp_client_posix.c',
'src/core/lib/iomgr/tcp_client_windows.c',
diff --git a/build.yaml b/build.yaml
index 857ef6c8ee6..584084ff865 100644
--- a/build.yaml
+++ b/build.yaml
@@ -293,7 +293,6 @@ filegroups:
- src/core/lib/iomgr/socket_utils_common_posix.c
- src/core/lib/iomgr/socket_utils_linux.c
- src/core/lib/iomgr/socket_utils_posix.c
- - src/core/lib/iomgr/socket_utils_tos_posix.c
- src/core/lib/iomgr/socket_windows.c
- src/core/lib/iomgr/tcp_client_posix.c
- src/core/lib/iomgr/tcp_client_windows.c
@@ -2438,20 +2437,6 @@ targets:
- mac
- linux
- posix
-- name: socket_utils_tos_test
- build: test
- language: c
- src:
- - test/core/iomgr/socket_utils_tos_test.c
- deps:
- - grpc_test_util
- - grpc
- - gpr_test_util
- - gpr
- platforms:
- - mac
- - linux
- - posix
- name: tcp_client_posix_test
cpu_cost: 0.5
build: test
diff --git a/config.m4 b/config.m4
index 7012fb0c54d..0f103655a84 100644
--- a/config.m4
+++ b/config.m4
@@ -127,7 +127,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \
src/core/lib/iomgr/socket_utils_posix.c \
- src/core/lib/iomgr/socket_utils_tos_posix.c \
src/core/lib/iomgr/socket_windows.c \
src/core/lib/iomgr/tcp_client_posix.c \
src/core/lib/iomgr/tcp_client_windows.c \
diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec
index 7b74143f415..6886bdfb5aa 100644
--- a/gRPC-Core.podspec
+++ b/gRPC-Core.podspec
@@ -457,7 +457,6 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/socket_utils_common_posix.c',
'src/core/lib/iomgr/socket_utils_linux.c',
'src/core/lib/iomgr/socket_utils_posix.c',
- 'src/core/lib/iomgr/socket_utils_tos_posix.c',
'src/core/lib/iomgr/socket_windows.c',
'src/core/lib/iomgr/tcp_client_posix.c',
'src/core/lib/iomgr/tcp_client_windows.c',
diff --git a/grpc.gemspec b/grpc.gemspec
index 23537983552..6079ea2aef5 100755
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -377,7 +377,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/socket_utils_common_posix.c )
s.files += %w( src/core/lib/iomgr/socket_utils_linux.c )
s.files += %w( src/core/lib/iomgr/socket_utils_posix.c )
- s.files += %w( src/core/lib/iomgr/socket_utils_tos_posix.c )
s.files += %w( src/core/lib/iomgr/socket_windows.c )
s.files += %w( src/core/lib/iomgr/tcp_client_posix.c )
s.files += %w( src/core/lib/iomgr/tcp_client_windows.c )
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h
index aad604a3b47..6621119d255 100644
--- a/include/grpc/impl/codegen/grpc_types.h
+++ b/include/grpc/impl/codegen/grpc_types.h
@@ -201,10 +201,20 @@ typedef struct {
#define GRPC_ARG_MAX_METADATA_SIZE "grpc.max_metadata_size"
/** If non-zero, allow the use of SO_REUSEPORT if it's available (default 1) */
#define GRPC_ARG_ALLOW_REUSEPORT "grpc.so_reuseport"
-/** The Type-Of-Service (TOS), in bytes. */
-#define GRPC_ARG_TOS "grpc.tos"
+/** The grpc_socket_mutator instance that set the socket options. A pointer. */
+#define GRPC_ARG_SOCKET_MUTATOR "grpc.socket_mutator"
/** \} */
+typedef struct grpc_socket_mutator grpc_socket_mutator;
+
+typedef struct grpc_socket_mutator_vtable {
+ bool (*mutate_fd)(int fd, grpc_socket_mutator *mutator);
+} grpc_socket_mutator_vtable;
+
+struct grpc_socket_mutator {
+ const grpc_socket_mutator_vtable *vtable;
+};
+
/** Result of a grpc call. If the caller satisfies the prerequisites of a
particular operation, the grpc_call_error returned will be GRPC_CALL_OK.
Receiving any other value listed here is an indication of a bug in the
diff --git a/package.xml b/package.xml
index 489504c43f6..7bac6957871 100644
--- a/package.xml
+++ b/package.xml
@@ -384,7 +384,6 @@
-
diff --git a/src/core/lib/iomgr/socket_utils_common_posix.c b/src/core/lib/iomgr/socket_utils_common_posix.c
index d2f6261e2ab..8c33ba37546 100644
--- a/src/core/lib/iomgr/socket_utils_common_posix.c
+++ b/src/core/lib/iomgr/socket_utils_common_posix.c
@@ -208,6 +208,15 @@ grpc_error *grpc_set_socket_low_latency(int fd, int low_latency) {
return GRPC_ERROR_NONE;
}
+/* set a socker using a grpc_socket_mutator */
+grpc_error *grpc_set_socket_with_mutator(int fd, grpc_socket_mutator *mutator) {
+ GPR_ASSERT(mutator);
+ if (!mutator->vtable->mutate_fd(fd, mutator)) {
+ return GRPC_ERROR_CREATE("grpc_socket_mutator failed.");
+ }
+ return GRPC_ERROR_NONE;
+}
+
static gpr_once g_probe_ipv6_once = GPR_ONCE_INIT;
static int g_ipv6_loopback_available;
diff --git a/src/core/lib/iomgr/socket_utils_posix.h b/src/core/lib/iomgr/socket_utils_posix.h
index bf4cc96af2b..d84a95d3d39 100644
--- a/src/core/lib/iomgr/socket_utils_posix.h
+++ b/src/core/lib/iomgr/socket_utils_posix.h
@@ -87,8 +87,8 @@ grpc_error *grpc_set_socket_sndbuf(int fd, int buffer_size_bytes);
/* Tries to set the socket's receive buffer to given size. */
grpc_error *grpc_set_socket_rcvbuf(int fd, int buffer_size_bytes);
-/* Tries to set the socket's type to service */
-grpc_error *grpc_set_socket_tos(int fd, grpc_arg *arg);
+/* Tries to set the socket using a grpc_socket_mutator */
+grpc_error *grpc_set_socket_with_mutator(int fd, grpc_socket_mutator *mutator);
/* An enum to keep track of IPv4/IPv6 socket modes.
diff --git a/src/core/lib/iomgr/socket_utils_tos_posix.c b/src/core/lib/iomgr/socket_utils_tos_posix.c
deleted file mode 100644
index 603ad3c421d..00000000000
--- a/src/core/lib/iomgr/socket_utils_tos_posix.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include
-
-#ifdef GPR_POSIX_SOCKET
-
-#include "src/core/lib/iomgr/socket_utils_posix.h"
-
-#include
-#include
-#include
-
-#include
-#include
-
-grpc_error* grpc_set_socket_tos(int fd, grpc_arg* arg) {
- int newval;
- socklen_t intlen = sizeof(newval);
-
- GPR_ASSERT(0 == strcmp(arg->key, GRPC_ARG_TOS));
- GPR_ASSERT(arg->type == GRPC_ARG_INTEGER);
-
- if (0 != setsockopt(fd, IPPROTO_IP, IP_TOS, &arg->value.integer,
- sizeof(arg->value.integer))) {
- return GRPC_OS_ERROR(errno, "setsockopt(IP_TOS)");
- }
- if (0 != getsockopt(fd, IPPROTO_IP, IP_TOS, &newval, &intlen)) {
- return GRPC_OS_ERROR(errno, "getsockopt(IP_TOS)");
- }
- if (newval != arg->value.integer) {
- return GRPC_ERROR_CREATE("Failed to set IP_TOS");
- }
-
- return GRPC_ERROR_NONE;
-}
-
-#endif
diff --git a/src/core/lib/iomgr/tcp_client_posix.c b/src/core/lib/iomgr/tcp_client_posix.c
index 1439efe706f..84eb41ecd28 100644
--- a/src/core/lib/iomgr/tcp_client_posix.c
+++ b/src/core/lib/iomgr/tcp_client_posix.c
@@ -89,10 +89,11 @@ static grpc_error *prepare_socket(const struct sockaddr *addr, int fd,
if (err != GRPC_ERROR_NONE) goto error;
if (channel_args) {
for (size_t i = 0; i < channel_args->num_args; i++) {
- if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_TOS)) {
- err = grpc_set_socket_tos(fd, &channel_args->args[i]);
+ if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_SOCKET_MUTATOR)) {
+ GPR_ASSERT(channel_args->args[i].type == GRPC_ARG_POINTER);
+ grpc_socket_mutator *mutator = channel_args->args[i].value.pointer.p;
+ err = grpc_set_socket_with_mutator(fd, mutator);
if (err != GRPC_ERROR_NONE) goto error;
- break;
}
}
}
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index dec578edb5c..2bebf48c70a 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -121,7 +121,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/iomgr/socket_utils_common_posix.c',
'src/core/lib/iomgr/socket_utils_linux.c',
'src/core/lib/iomgr/socket_utils_posix.c',
- 'src/core/lib/iomgr/socket_utils_tos_posix.c',
'src/core/lib/iomgr/socket_windows.c',
'src/core/lib/iomgr/tcp_client_posix.c',
'src/core/lib/iomgr/tcp_client_windows.c',
diff --git a/test/core/iomgr/socket_utils_test.c b/test/core/iomgr/socket_utils_test.c
index 297531c44d2..113668b4e94 100644
--- a/test/core/iomgr/socket_utils_test.c
+++ b/test/core/iomgr/socket_utils_test.c
@@ -35,11 +35,37 @@
#include "src/core/lib/iomgr/socket_utils_posix.h"
#include
+#include
#include
#include
#include "test/core/util/test_config.h"
+struct test_socket_mutator {
+ grpc_socket_mutator base;
+ int option_value;
+};
+
+static bool mutate_fd(int fd, grpc_socket_mutator* mutator) {
+ int newval;
+ socklen_t intlen = sizeof(newval);
+ struct test_socket_mutator* m = (struct test_socket_mutator*)mutator;
+
+ if (0 != setsockopt(fd, IPPROTO_IP, IP_TOS, &m->option_value,
+ sizeof(m->option_value))) {
+ return false;
+ }
+ if (0 != getsockopt(fd, IPPROTO_IP, IP_TOS, &newval, &intlen)) {
+ return false;
+ }
+ if (newval != m->option_value) {
+ return false;
+ }
+ return true;
+}
+
+static const grpc_socket_mutator_vtable mutator_vtable = {mutate_fd};
+
int main(int argc, char **argv) {
int sock;
grpc_test_init(argc, argv);
@@ -64,6 +90,28 @@ int main(int argc, char **argv) {
GPR_ASSERT(GRPC_LOG_IF_ERROR("set_socket_low_latency",
grpc_set_socket_low_latency(sock, 0)));
+ struct test_socket_mutator mutator;
+ mutator.base.vtable = &mutator_vtable;
+
+ mutator.option_value = IPTOS_LOWDELAY;
+ GPR_ASSERT(GRPC_LOG_IF_ERROR(
+ "set_socket_with_mutator",
+ grpc_set_socket_with_mutator(sock, (grpc_socket_mutator*)&mutator)));
+
+ mutator.option_value = IPTOS_THROUGHPUT;
+ GPR_ASSERT(GRPC_LOG_IF_ERROR(
+ "set_socket_with_mutator",
+ grpc_set_socket_with_mutator(sock, (grpc_socket_mutator*)&mutator)));
+
+ mutator.option_value = IPTOS_RELIABILITY;
+ GPR_ASSERT(GRPC_LOG_IF_ERROR(
+ "set_socket_with_mutator",
+ grpc_set_socket_with_mutator(sock, (grpc_socket_mutator*)&mutator)));
+
+ mutator.option_value = -1;
+ GPR_ASSERT(GRPC_ERROR_NONE != grpc_set_socket_with_mutator(
+ sock, (grpc_socket_mutator*)&mutator));
+
close(sock);
return 0;
diff --git a/test/core/iomgr/socket_utils_tos_test.c b/test/core/iomgr/socket_utils_tos_test.c
deleted file mode 100644
index ee3a43367b8..00000000000
--- a/test/core/iomgr/socket_utils_tos_test.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- * Copyright 2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include
-#include "src/core/lib/iomgr/socket_utils_posix.h"
-
-#include
-#include
-#include
-
-#include
-#include "test/core/util/test_config.h"
-
-int main(int argc, char **argv) {
- int sock;
- grpc_arg tos_arg;
- grpc_test_init(argc, argv);
-
- sock = socket(PF_INET, SOCK_STREAM, 0);
- GPR_ASSERT(sock > 0);
-
- tos_arg.key = GRPC_ARG_TOS;
- tos_arg.type = GRPC_ARG_INTEGER;
- tos_arg.value.integer = IPTOS_LOWDELAY;
- GPR_ASSERT(
- GRPC_LOG_IF_ERROR("set_socket_tos", grpc_set_socket_tos(sock, &tos_arg)));
- tos_arg.value.integer = IPTOS_THROUGHPUT;
- GPR_ASSERT(
- GRPC_LOG_IF_ERROR("set_socket_tos", grpc_set_socket_tos(sock, &tos_arg)));
- tos_arg.value.integer = IPTOS_RELIABILITY;
- GPR_ASSERT(
- GRPC_LOG_IF_ERROR("set_socket_tos", grpc_set_socket_tos(sock, &tos_arg)));
-
- close(sock);
-
- return 0;
-}
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index 59998f03fba..44f147aeb18 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -994,7 +994,6 @@ src/core/lib/iomgr/sockaddr_utils.c \
src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \
src/core/lib/iomgr/socket_utils_posix.c \
-src/core/lib/iomgr/socket_utils_tos_posix.c \
src/core/lib/iomgr/socket_windows.c \
src/core/lib/iomgr/tcp_client_posix.c \
src/core/lib/iomgr/tcp_client_windows.c \
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index 5ecb3ee0f87..c05d194e19e 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -1858,23 +1858,6 @@
"third_party": false,
"type": "target"
},
- {
- "deps": [
- "gpr",
- "gpr_test_util",
- "grpc",
- "grpc_test_util"
- ],
- "headers": [],
- "is_filegroup": false,
- "language": "c",
- "name": "socket_utils_tos_test",
- "src": [
- "test/core/iomgr/socket_utils_tos_test.c"
- ],
- "third_party": false,
- "type": "target"
- },
{
"deps": [
"gpr",
@@ -6550,7 +6533,6 @@
"src/core/lib/iomgr/socket_utils_linux.c",
"src/core/lib/iomgr/socket_utils_posix.c",
"src/core/lib/iomgr/socket_utils_posix.h",
- "src/core/lib/iomgr/socket_utils_tos_posix.c",
"src/core/lib/iomgr/socket_windows.c",
"src/core/lib/iomgr/socket_windows.h",
"src/core/lib/iomgr/tcp_client.h",
diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json
index 07b51d3c2f3..c3395067c94 100644
--- a/tools/run_tests/tests.json
+++ b/tools/run_tests/tests.json
@@ -1819,25 +1819,6 @@
"posix"
]
},
- {
- "args": [],
- "ci_platforms": [
- "linux",
- "mac",
- "posix"
- ],
- "cpu_cost": 1.0,
- "exclude_configs": [],
- "flaky": false,
- "gtest": false,
- "language": "c",
- "name": "socket_utils_tos_test",
- "platforms": [
- "linux",
- "mac",
- "posix"
- ]
- },
{
"args": [],
"ci_platforms": [
diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj
index f115001507f..965d06d1d5c 100644
--- a/vsprojects/vcxproj/grpc/grpc.vcxproj
+++ b/vsprojects/vcxproj/grpc/grpc.vcxproj
@@ -549,8 +549,6 @@
-
-
diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
index 81dae475a1d..dddd4ecce51 100644
--- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
@@ -133,9 +133,6 @@
src\core\lib\iomgr
-
- src\core\lib\iomgr
-
src\core\lib\iomgr
diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj
index da631cd0dc1..b724c217ed4 100644
--- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj
+++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj
@@ -397,8 +397,6 @@
-
-
diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters
index b42b5ec68a7..92806fa04a2 100644
--- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters
@@ -187,9 +187,6 @@
src\core\lib\iomgr
-
- src\core\lib\iomgr
-
src\core\lib\iomgr
diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
index 921eaf3780d..b46773632cb 100644
--- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
+++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
@@ -517,8 +517,6 @@
-
-
diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
index c7d0106dc57..6ffc1eab708 100644
--- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
@@ -136,9 +136,6 @@
src\core\lib\iomgr
-
- src\core\lib\iomgr
-
src\core\lib\iomgr