From 4273f1e3bc411a1aff34fedad5eaf0c967801b93 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Mon, 4 May 2015 14:51:27 -0700 Subject: add client side streaming interfaces --- include/grpc++/async_unary_call.h | 13 +++++- include/grpc++/stream.h | 98 ++++++++++++++++++++++++++------------- 2 files changed, 79 insertions(+), 32 deletions(-) (limited to 'include') diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h index d1d5be5b50..97cec77955 100644 --- a/include/grpc++/async_unary_call.h +++ b/include/grpc++/async_unary_call.h @@ -44,8 +44,19 @@ #include namespace grpc { + +template +class ClientAsyncResponseReaderInterface { + public: + virtual ~ClientAsyncResponseReaderInterface() {} + virtual void ReadInitialMetadata(void* tag) = 0; + virtual void Finish(R* msg, Status* status, void* tag) = 0; + +}; + template -class ClientAsyncResponseReader GRPC_FINAL { +class ClientAsyncResponseReader GRPC_FINAL + : public ClientAsyncResponseReaderInterface { public: ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 6647e345c0..0efdbdaeca 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -83,8 +83,14 @@ class WriterInterface { }; template -class ClientReader GRPC_FINAL : public ClientStreamingInterface, - public ReaderInterface { +class ClientReaderInterface : public ClientStreamingInterface, + public ReaderInterface { + public: + virtual void WaitForInitialMetadata() = 0; +}; + +template +class ClientReader GRPC_FINAL : public ClientReaderInterface { public: // Blocking create a stream and write the first request out. ClientReader(ChannelInterface* channel, const RpcMethod& method, @@ -111,7 +117,7 @@ class ClientReader GRPC_FINAL : public ClientStreamingInterface, GPR_ASSERT(cq_.Pluck(&buf)); } - virtual bool Read(R* msg) GRPC_OVERRIDE { + bool Read(R* msg) GRPC_OVERRIDE { CallOpBuffer buf; if (!context_->initial_metadata_received_) { buf.AddRecvInitialMetadata(context_); @@ -121,7 +127,7 @@ class ClientReader GRPC_FINAL : public ClientStreamingInterface, return cq_.Pluck(&buf) && buf.got_message; } - virtual Status Finish() GRPC_OVERRIDE { + Status Finish() GRPC_OVERRIDE { CallOpBuffer buf; Status status; buf.AddClientRecvStatus(context_, &status); @@ -137,8 +143,14 @@ class ClientReader GRPC_FINAL : public ClientStreamingInterface, }; template -class ClientWriter GRPC_FINAL : public ClientStreamingInterface, - public WriterInterface { +class ClientWriterInterface : public ClientStreamingInterface, + public WriterInterface { + public: + virtual bool WritesDone() = 0; +}; + +template +class ClientWriter GRPC_FINAL : public ClientWriterInterface { public: // Blocking create a stream. ClientWriter(ChannelInterface* channel, const RpcMethod& method, @@ -152,14 +164,14 @@ class ClientWriter GRPC_FINAL : public ClientStreamingInterface, cq_.Pluck(&buf); } - virtual bool Write(const W& msg) GRPC_OVERRIDE { + bool Write(const W& msg) GRPC_OVERRIDE { CallOpBuffer buf; buf.AddSendMessage(msg); call_.PerformOps(&buf); return cq_.Pluck(&buf); } - virtual bool WritesDone() { + bool WritesDone() GRPC_OVERRIDE { CallOpBuffer buf; buf.AddClientSendClose(); call_.PerformOps(&buf); @@ -167,7 +179,7 @@ class ClientWriter GRPC_FINAL : public ClientStreamingInterface, } // Read the final response and wait for the final status. - virtual Status Finish() GRPC_OVERRIDE { + Status Finish() GRPC_OVERRIDE { CallOpBuffer buf; Status status; buf.AddRecvMessage(response_); @@ -186,9 +198,16 @@ class ClientWriter GRPC_FINAL : public ClientStreamingInterface, // Client-side interface for bi-directional streaming. template -class ClientReaderWriter GRPC_FINAL : public ClientStreamingInterface, - public WriterInterface, - public ReaderInterface { +class ClientReaderWriterInterface : public ClientStreamingInterface, + public WriterInterface, + public ReaderInterface { + public: + virtual void WaitForInitialMetadata() = 0; + virtual bool WritesDone() = 0; +}; + +template +class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface { public: // Blocking create a stream. ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, @@ -213,7 +232,7 @@ class ClientReaderWriter GRPC_FINAL : public ClientStreamingInterface, GPR_ASSERT(cq_.Pluck(&buf)); } - virtual bool Read(R* msg) GRPC_OVERRIDE { + bool Read(R* msg) GRPC_OVERRIDE { CallOpBuffer buf; if (!context_->initial_metadata_received_) { buf.AddRecvInitialMetadata(context_); @@ -223,21 +242,21 @@ class ClientReaderWriter GRPC_FINAL : public ClientStreamingInterface, return cq_.Pluck(&buf) && buf.got_message; } - virtual bool Write(const W& msg) GRPC_OVERRIDE { + bool Write(const W& msg) GRPC_OVERRIDE { CallOpBuffer buf; buf.AddSendMessage(msg); call_.PerformOps(&buf); return cq_.Pluck(&buf); } - virtual bool WritesDone() { + bool WritesDone() GRPC_OVERRIDE { CallOpBuffer buf; buf.AddClientSendClose(); call_.PerformOps(&buf); return cq_.Pluck(&buf); } - virtual Status Finish() GRPC_OVERRIDE { + Status Finish() GRPC_OVERRIDE { CallOpBuffer buf; Status status; buf.AddClientRecvStatus(context_, &status); @@ -267,7 +286,7 @@ class ServerReader GRPC_FINAL : public ReaderInterface { call_->cq()->Pluck(&buf); } - virtual bool Read(R* msg) GRPC_OVERRIDE { + bool Read(R* msg) GRPC_OVERRIDE { CallOpBuffer buf; buf.AddRecvMessage(msg); call_->PerformOps(&buf); @@ -294,7 +313,7 @@ class ServerWriter GRPC_FINAL : public WriterInterface { call_->cq()->Pluck(&buf); } - virtual bool Write(const W& msg) GRPC_OVERRIDE { + bool Write(const W& msg) GRPC_OVERRIDE { CallOpBuffer buf; if (!ctx_->sent_initial_metadata_) { buf.AddSendInitialMetadata(&ctx_->initial_metadata_); @@ -327,14 +346,14 @@ class ServerReaderWriter GRPC_FINAL : public WriterInterface, call_->cq()->Pluck(&buf); } - virtual bool Read(R* msg) GRPC_OVERRIDE { + bool Read(R* msg) GRPC_OVERRIDE { CallOpBuffer buf; buf.AddRecvMessage(msg); call_->PerformOps(&buf); return call_->cq()->Pluck(&buf) && buf.got_message; } - virtual bool Write(const W& msg) GRPC_OVERRIDE { + bool Write(const W& msg) GRPC_OVERRIDE { CallOpBuffer buf; if (!ctx_->sent_initial_metadata_) { buf.AddSendInitialMetadata(&ctx_->initial_metadata_); @@ -380,8 +399,12 @@ class AsyncWriterInterface { }; template -class ClientAsyncReader GRPC_FINAL : public ClientAsyncStreamingInterface, - public AsyncReaderInterface { +class ClientAsyncReaderInterface : public ClientAsyncStreamingInterface, + public AsyncReaderInterface { +}; + +template +class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface { public: // Create a stream and write the first request out. ClientAsyncReader(ChannelInterface* channel, CompletionQueue* cq, @@ -431,8 +454,14 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncStreamingInterface, }; template -class ClientAsyncWriter GRPC_FINAL : public ClientAsyncStreamingInterface, - public AsyncWriterInterface { +class ClientAsyncWriterInterface : public ClientAsyncStreamingInterface, + public AsyncWriterInterface { + public: + virtual void WritesDone(void* tag) = 0; +}; + +template +class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface { public: ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, @@ -459,7 +488,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncStreamingInterface, call_.PerformOps(&write_buf_); } - void WritesDone(void* tag) { + void WritesDone(void* tag) GRPC_OVERRIDE { writes_done_buf_.Reset(tag); writes_done_buf_.AddClientSendClose(); call_.PerformOps(&writes_done_buf_); @@ -488,9 +517,16 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncStreamingInterface, // Client-side interface for bi-directional streaming. template -class ClientAsyncReaderWriter GRPC_FINAL : public ClientAsyncStreamingInterface, - public AsyncWriterInterface, - public AsyncReaderInterface { +class ClientAsyncReaderWriterInterface : public ClientAsyncStreamingInterface, + public AsyncWriterInterface, + public AsyncReaderInterface { + public: + virtual void WritesDone(void* tag) = 0; +}; + +template +class ClientAsyncReaderWriter GRPC_FINAL + : public ClientAsyncReaderWriterInterface { public: ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, @@ -524,7 +560,7 @@ class ClientAsyncReaderWriter GRPC_FINAL : public ClientAsyncStreamingInterface, call_.PerformOps(&write_buf_); } - void WritesDone(void* tag) { + void WritesDone(void* tag) GRPC_OVERRIDE { writes_done_buf_.Reset(tag); writes_done_buf_.AddClientSendClose(); call_.PerformOps(&writes_done_buf_); @@ -671,13 +707,13 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, call_.PerformOps(&meta_buf_); } - virtual void Read(R* msg, void* tag) GRPC_OVERRIDE { + void Read(R* msg, void* tag) GRPC_OVERRIDE { read_buf_.Reset(tag); read_buf_.AddRecvMessage(msg); call_.PerformOps(&read_buf_); } - virtual void Write(const W& msg, void* tag) GRPC_OVERRIDE { + void Write(const W& msg, void* tag) GRPC_OVERRIDE { write_buf_.Reset(tag); if (!ctx_->sent_initial_metadata_) { write_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); -- cgit v1.2.3 From b96d0015840cbb5a22212cb70852fc8b99a67a81 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 6 May 2015 15:33:23 -0700 Subject: Validate that headers contain legal bytes --- include/grpc/grpc.h | 4 +++- src/core/surface/call.c | 37 +++++++++++++++++++++++++++++-------- src/core/transport/metadata.c | 16 ++++++++++++++++ src/core/transport/metadata.h | 3 +++ 4 files changed, 51 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 9bb826f323..3348653956 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -140,7 +140,9 @@ typedef enum grpc_call_error { /* there is already an outstanding read/write operation on the call */ GRPC_CALL_ERROR_TOO_MANY_OPERATIONS, /* the flags value was illegal for this call */ - GRPC_CALL_ERROR_INVALID_FLAGS + GRPC_CALL_ERROR_INVALID_FLAGS, + /* invalid metadata was passed to this call */ + GRPC_CALL_ERROR_INVALID_METADATA } grpc_call_error; /* Result of a grpc operation */ diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 7ab9142947..9ee91785e8 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -739,14 +739,9 @@ static void call_on_done_recv(void *pc, int success) { GRPC_TIMER_BEGIN(GRPC_PTAG_CALL_ON_DONE_RECV, 0); } -static grpc_mdelem_list chain_metadata_from_app(grpc_call *call, size_t count, - grpc_metadata *metadata) { +static int prepare_application_metadata(grpc_call *call, size_t count, + grpc_metadata *metadata) { size_t i; - grpc_mdelem_list out; - if (count == 0) { - out.head = out.tail = NULL; - return out; - } for (i = 0; i < count; i++) { grpc_metadata *md = &metadata[i]; grpc_metadata *next_md = (i == count - 1) ? NULL : &metadata[i + 1]; @@ -756,9 +751,27 @@ static grpc_mdelem_list chain_metadata_from_app(grpc_call *call, size_t count, l->md = grpc_mdelem_from_string_and_buffer(call->metadata_context, md->key, (const gpr_uint8 *)md->value, md->value_length); + if (!grpc_mdstr_is_legal_header(l->md->key)) { + gpr_log(GPR_ERROR, "attempt to send invalid metadata key"); + return 0; + } else if (!grpc_mdstr_is_bin_suffixed(l->md->key) && + !grpc_mdstr_is_legal_header(l->md->value)) { + gpr_log(GPR_ERROR, "attempt to send invalid metadata value"); + return 0; + } l->next = next_md ? (grpc_linked_mdelem *)&next_md->internal_data : NULL; l->prev = prev_md ? (grpc_linked_mdelem *)&prev_md->internal_data : NULL; } + return 1; +} + +static grpc_mdelem_list chain_metadata_from_app(grpc_call *call, size_t count, + grpc_metadata *metadata) { + grpc_mdelem_list out; + if (count == 0) { + out.head = out.tail = NULL; + return out; + } out.head = (grpc_linked_mdelem *)&(metadata[0].internal_data); out.tail = (grpc_linked_mdelem *)&(metadata[count - 1].internal_data); return out; @@ -954,8 +967,16 @@ static grpc_call_error start_ioreq(grpc_call *call, const grpc_ioreq *reqs, } else if (call->request_set[op] == REQSET_DONE) { return start_ioreq_error(call, have_ops, GRPC_CALL_ERROR_ALREADY_INVOKED); } - have_ops |= 1u << op; data = reqs[i].data; + if (op == GRPC_IOREQ_SEND_INITIAL_METADATA || + op == GRPC_IOREQ_SEND_TRAILING_METADATA) { + if (!prepare_application_metadata(call, data.send_metadata.count, + data.send_metadata.metadata)) { + return start_ioreq_error(call, have_ops, + GRPC_CALL_ERROR_INVALID_METADATA); + } + } + have_ops |= 1u << op; call->request_data[op] = data; call->request_set[op] = set; diff --git a/src/core/transport/metadata.c b/src/core/transport/metadata.c index 74e94b2c24..c80d67823f 100644 --- a/src/core/transport/metadata.c +++ b/src/core/transport/metadata.c @@ -569,3 +569,19 @@ void grpc_mdctx_locked_mdelem_unref(grpc_mdctx *ctx, grpc_mdelem *gmd) { } void grpc_mdctx_unlock(grpc_mdctx *ctx) { unlock(ctx); } + +int grpc_mdstr_is_legal_header(grpc_mdstr *s) { + /* TODO(ctiller): consider caching this, or computing it on construction */ + const gpr_uint8 *p = GPR_SLICE_START_PTR(s->slice); + const gpr_uint8 *e = GPR_SLICE_END_PTR(s->slice); + for (; p != e; p++) { + if (*p < 32 || *p > 126) return 0; + } + return 1; +} + +int grpc_mdstr_is_bin_suffixed(grpc_mdstr *s) { + /* TODO(ctiller): consider caching this */ + return grpc_is_binary_header((const char *)GPR_SLICE_START_PTR(s->slice), + GPR_SLICE_LENGTH(s->slice)); +} diff --git a/src/core/transport/metadata.h b/src/core/transport/metadata.h index 21b8ae2b78..e7508718f5 100644 --- a/src/core/transport/metadata.h +++ b/src/core/transport/metadata.h @@ -135,6 +135,9 @@ void grpc_mdelem_unref(grpc_mdelem *md); Does not promise that the returned string has no embedded nulls however. */ const char *grpc_mdstr_as_c_string(grpc_mdstr *s); +int grpc_mdstr_is_legal_header(grpc_mdstr *s); +int grpc_mdstr_is_bin_suffixed(grpc_mdstr *s); + /* Batch mode metadata functions. These API's have equivalents above, but allow taking the mdctx just once, performing a bunch of work, and then leaving the mdctx. */ -- cgit v1.2.3 From 2da029647803aa26e393faa1422beecae7d1805a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 6 May 2015 16:14:25 -0700 Subject: Eliminate need for SIGPIPE handling --- include/grpc/support/port_platform.h | 4 ++++ src/core/iomgr/socket_utils_common_posix.c | 13 +++++++++++++ src/core/iomgr/socket_utils_posix.h | 5 +++++ src/core/iomgr/tcp_client_posix.c | 3 ++- src/core/iomgr/tcp_posix.c | 8 +++++++- src/core/iomgr/tcp_server_posix.c | 5 ++++- test/core/util/test_config.c | 4 ---- test/cpp/qps/smoke_test.cc | 1 - 8 files changed, 35 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 671648a976..df7861c7b6 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -80,6 +80,7 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_MSG_NOSIGNAL 1 #elif defined(__linux__) #ifndef _BSD_SOURCE #define _BSD_SOURCE @@ -124,6 +125,7 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_MSG_NOSIGNAL 1 #ifdef _LP64 #define GPR_ARCH_64 1 #else /* _LP64 */ @@ -155,6 +157,7 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_SO_NOSIGPIPE 1 #ifdef _LP64 #define GPR_ARCH_64 1 #else /* _LP64 */ @@ -180,6 +183,7 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_SO_NOSIGPIPE 1 #ifdef _LP64 #define GPR_ARCH_64 1 #else /* _LP64 */ diff --git a/src/core/iomgr/socket_utils_common_posix.c b/src/core/iomgr/socket_utils_common_posix.c index 3c8cafa315..a9af594700 100644 --- a/src/core/iomgr/socket_utils_common_posix.c +++ b/src/core/iomgr/socket_utils_common_posix.c @@ -76,6 +76,19 @@ int grpc_set_socket_nonblocking(int fd, int non_blocking) { return 1; } +int grpc_set_socket_no_sigpipe_if_possible(int fd) { +#ifdef GPR_HAVE_SO_NOSIGPIPE + int val = 1; + int newval; + socklen_t intlen = sizeof(newval); + return 0 == setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val)) && + 0 == getsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &newval, &intlen) && + (newval != 0) == val; +#else + return 1; +#endif +} + /* set a socket to close on exec */ int grpc_set_socket_cloexec(int fd, int close_on_exec) { int oldflags = fcntl(fd, F_GETFD, 0); diff --git a/src/core/iomgr/socket_utils_posix.h b/src/core/iomgr/socket_utils_posix.h index c161082afc..d2a315b462 100644 --- a/src/core/iomgr/socket_utils_posix.h +++ b/src/core/iomgr/socket_utils_posix.h @@ -63,6 +63,11 @@ int grpc_set_socket_low_latency(int fd, int low_latency); state to library users, we turn off IPv6 sockets. */ int grpc_ipv6_loopback_available(void); +/* Tries to set SO_NOSIGPIPE if available on this platform. + Returns 1 on success, 0 on failure. + If SO_NO_SIGPIPE is not available, returns 1. */ +int grpc_set_socket_no_sigpipe_if_possible(int fd); + /* An enum to keep track of IPv4/IPv6 socket modes. Currently, this information is only used when a socket is first created, but diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/iomgr/tcp_client_posix.c index e20cc3d1b2..2401fe00e4 100644 --- a/src/core/iomgr/tcp_client_posix.c +++ b/src/core/iomgr/tcp_client_posix.c @@ -69,7 +69,8 @@ static int prepare_socket(const struct sockaddr *addr, int fd) { } if (!grpc_set_socket_nonblocking(fd, 1) || !grpc_set_socket_cloexec(fd, 1) || - (addr->sa_family != AF_UNIX && !grpc_set_socket_low_latency(fd, 1))) { + (addr->sa_family != AF_UNIX && !grpc_set_socket_low_latency(fd, 1)) || + !grpc_set_socket_no_sigpipe_if_possible(fd)) { gpr_log(GPR_ERROR, "Unable to configure socket %d: %s", fd, strerror(errno)); goto error; diff --git a/src/core/iomgr/tcp_posix.c b/src/core/iomgr/tcp_posix.c index 06725fbc89..f7dae5f86c 100644 --- a/src/core/iomgr/tcp_posix.c +++ b/src/core/iomgr/tcp_posix.c @@ -53,6 +53,12 @@ #include #include +#ifdef GPR_HAVE_MSG_NOSIGNAL +#define SENDMSG_FLAGS MSG_NOSIGNAL +#else +#define SENDMSG_FLAGS 0 +#endif + /* Holds a slice array and associated state. */ typedef struct grpc_tcp_slice_state { gpr_slice *slices; /* Array of slices */ @@ -461,7 +467,7 @@ static grpc_endpoint_write_status grpc_tcp_flush(grpc_tcp *tcp) { GRPC_TIMER_BEGIN(GRPC_PTAG_SENDMSG, 0); do { /* TODO(klempner): Cork if this is a partial write */ - sent_length = sendmsg(tcp->fd, &msg, 0); + sent_length = sendmsg(tcp->fd, &msg, SENDMSG_FLAGS); } while (sent_length < 0 && errno == EINTR); GRPC_TIMER_END(GRPC_PTAG_SENDMSG, 0); diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c index 7e31f2d7a5..d1cd8a769c 100644 --- a/src/core/iomgr/tcp_server_posix.c +++ b/src/core/iomgr/tcp_server_posix.c @@ -235,7 +235,8 @@ static int prepare_socket(int fd, const struct sockaddr *addr, int addr_len) { if (!grpc_set_socket_nonblocking(fd, 1) || !grpc_set_socket_cloexec(fd, 1) || (addr->sa_family != AF_UNIX && (!grpc_set_socket_low_latency(fd, 1) || - !grpc_set_socket_reuse_addr(fd, 1)))) { + !grpc_set_socket_reuse_addr(fd, 1))) || + !grpc_set_socket_no_sigpipe_if_possible(fd)) { gpr_log(GPR_ERROR, "Unable to configure socket %d: %s", fd, strerror(errno)); goto error; @@ -296,6 +297,8 @@ static void on_read(void *arg, int success) { } } + grpc_set_socket_no_sigpipe_if_possible(fd); + sp->server->cb( sp->server->cb_arg, grpc_tcp_create(grpc_fd_create(fd), GRPC_TCP_DEFAULT_READ_SLICE_SIZE)); diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c index 1f0f0175b1..be69fcf675 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.c @@ -49,10 +49,6 @@ static int seed(void) { return _getpid(); } #endif void grpc_test_init(int argc, char **argv) { -#ifndef GPR_WIN32 - /* disable SIGPIPE */ - signal(SIGPIPE, SIG_IGN); -#endif gpr_log(GPR_DEBUG, "test slowdown: machine=%f build=%f total=%f", GRPC_TEST_SLOWDOWN_MACHINE_FACTOR, GRPC_TEST_SLOWDOWN_BUILD_FACTOR, GRPC_TEST_SLOWDOWN_FACTOR); diff --git a/test/cpp/qps/smoke_test.cc b/test/cpp/qps/smoke_test.cc index 2c60a9997c..1a44833940 100644 --- a/test/cpp/qps/smoke_test.cc +++ b/test/cpp/qps/smoke_test.cc @@ -138,7 +138,6 @@ static void RunQPS() { } // namespace grpc int main(int argc, char** argv) { - signal(SIGPIPE, SIG_IGN); using namespace grpc::testing; RunSynchronousStreamingPingPong(); RunSynchronousUnaryPingPong(); -- cgit v1.2.3