aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-09-17 08:42:44 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-09-17 08:42:44 -0700
commit6512ac9e57d937aaf1b1817f2cfc6b51210e4f2d (patch)
tree842812ee5d1a93d1b3905854933b541a85272a7d /src
parent3cd6a5158d388c6ae2d07bc78951c986dc4f41ea (diff)
parent19c06494b5144a9e21a12801140201a647752a4c (diff)
Merge github.com:grpc/grpc into shindig
Conflicts: src/core/iomgr/tcp_server_posix.c
Diffstat (limited to 'src')
-rw-r--r--src/core/channel/http_server_filter.c3
-rw-r--r--src/core/client_config/subchannel.h1
-rw-r--r--src/core/iomgr/pollset_posix.c12
-rw-r--r--src/core/iomgr/tcp_client_posix.c16
-rw-r--r--src/core/iomgr/tcp_server_posix.c4
5 files changed, 29 insertions, 7 deletions
diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c
index 0955ae319a..2f061946a1 100644
--- a/src/core/channel/http_server_filter.c
+++ b/src/core/channel/http_server_filter.c
@@ -46,6 +46,7 @@ typedef struct call_data {
gpr_uint8 seen_te_trailers;
gpr_uint8 seen_authority;
grpc_linked_mdelem status;
+ grpc_linked_mdelem content_type;
grpc_stream_op_buffer *recv_ops;
/** Closure to call when finished with the hs_on_recv hook */
@@ -202,6 +203,8 @@ static void hs_mutate_op(grpc_call_element *elem,
calld->sent_status = 1;
grpc_metadata_batch_add_head(&op->data.metadata, &calld->status,
GRPC_MDELEM_REF(channeld->status_ok));
+ grpc_metadata_batch_add_tail(&op->data.metadata, &calld->content_type,
+ GRPC_MDELEM_REF(channeld->content_type));
break;
}
}
diff --git a/src/core/client_config/subchannel.h b/src/core/client_config/subchannel.h
index 29a0b67d2d..2e36c69134 100644
--- a/src/core/client_config/subchannel.h
+++ b/src/core/client_config/subchannel.h
@@ -43,7 +43,6 @@ typedef struct grpc_subchannel grpc_subchannel;
typedef struct grpc_subchannel_call grpc_subchannel_call;
typedef struct grpc_subchannel_args grpc_subchannel_args;
-#define GRPC_SUBCHANNEL_REFCOUNT_DEBUG
#ifdef GRPC_SUBCHANNEL_REFCOUNT_DEBUG
#define GRPC_SUBCHANNEL_REF(p, r) \
grpc_subchannel_ref((p), __FILE__, __LINE__, (r))
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c
index 8bde41a146..2ed8c84ebb 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/iomgr/pollset_posix.c
@@ -187,6 +187,12 @@ void grpc_pollset_work(grpc_pollset *pollset, grpc_pollset_worker *worker,
if (pollset->shutting_down) {
goto done;
}
+ if (pollset->in_flight_cbs) {
+ /* Give do_promote priority so we don't starve it out */
+ gpr_mu_unlock(&pollset->mu);
+ gpr_mu_lock(&pollset->mu);
+ goto done;
+ }
if (!pollset->kicked_without_pollers) {
push_front_worker(pollset, worker);
added_worker = 1;
@@ -422,12 +428,6 @@ static void basic_pollset_maybe_work(grpc_pollset *pollset,
int r;
nfds_t nfds;
- if (pollset->in_flight_cbs) {
- /* Give do_promote priority so we don't starve it out */
- gpr_mu_unlock(&pollset->mu);
- gpr_mu_lock(&pollset->mu);
- return;
- }
fd = pollset->data.ptr;
if (fd && grpc_fd_is_orphaned(fd)) {
GRPC_FD_UNREF(fd, "basicpoll");
diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/iomgr/tcp_client_posix.c
index 8b1a3b0f9e..0df984c3e6 100644
--- a/src/core/iomgr/tcp_client_posix.c
+++ b/src/core/iomgr/tcp_client_posix.c
@@ -54,6 +54,8 @@
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
+extern int grpc_tcp_trace;
+
typedef struct {
void (*cb)(void *arg, grpc_endpoint *tcp);
void *cb_arg;
@@ -92,6 +94,10 @@ error:
static void tc_on_alarm(void *acp, int success) {
int done;
async_connect *ac = acp;
+ if (grpc_tcp_trace) {
+ gpr_log(GPR_DEBUG, "CLIENT_CONNECT: %s: on_alarm: success=%d", ac->addr_str,
+ success);
+ }
gpr_mu_lock(&ac->mu);
if (ac->fd != NULL) {
grpc_fd_shutdown(ac->fd);
@@ -116,6 +122,11 @@ static void on_writable(void *acp, int success) {
void *cb_arg = ac->cb_arg;
grpc_fd *fd;
+ if (grpc_tcp_trace) {
+ gpr_log(GPR_DEBUG, "CLIENT_CONNECT: %s: on_writable: success=%d",
+ ac->addr_str, success);
+ }
+
gpr_mu_lock(&ac->mu);
GPR_ASSERT(ac->fd);
fd = ac->fd;
@@ -265,6 +276,11 @@ void grpc_tcp_client_connect(void (*cb)(void *arg, grpc_endpoint *ep),
ac->write_closure.cb = on_writable;
ac->write_closure.cb_arg = ac;
+ if (grpc_tcp_trace) {
+ gpr_log(GPR_DEBUG, "CLIENT_CONNECT: %s: asynchronously connecting",
+ ac->addr_str);
+ }
+
gpr_mu_lock(&ac->mu);
grpc_alarm_init(&ac->alarm,
gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC),
diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c
index c6c716e4df..0b79678e9d 100644
--- a/src/core/iomgr/tcp_server_posix.c
+++ b/src/core/iomgr/tcp_server_posix.c
@@ -344,6 +344,10 @@ static void on_read(void *arg, int success) {
addr_str = grpc_sockaddr_to_uri((struct sockaddr *)&addr);
gpr_asprintf(&name, "tcp-server-connection:%s", addr_str);
+ if (grpc_tcp_trace) {
+ gpr_log(GPR_DEBUG, "SERVER_CONNECT: incoming connection: %s", addr_str);
+ }
+
fdobj = grpc_fd_create(fd, sp->server->workqueue, name);
/* TODO(ctiller): revise this when we have server-side sharding
of channels -- we certainly should not be automatically adding every