grpc 1.7.2 → 1.7.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/Makefile +50 -2
- data/include/grpc/impl/codegen/grpc_types.h +3 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.c +27 -3
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +2 -2
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +77 -13
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +2 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +13 -8
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +6 -4
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +5 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
- data/src/core/lib/transport/transport.h +0 -3
- data/src/ruby/lib/grpc/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ac20818bc47ac7d20578a82ff2b1d480900c66d6afcbd0db241e6e96b14b7815
|
4
|
+
data.tar.gz: cb1f936a85fe753862112223230ed7a0a427fe3af95c13fe3efc40c5a0caba2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87acd07474729f8072d1db6a2bf1b2ae6d212a0ccb8ae6c67ca155501d1f28bdf2031adceb280c1eef1981568d637bfa9472b6b63a5de2a09012e100d70290cb
|
7
|
+
data.tar.gz: 99dd529b5e2e58a83c48ddde5118d97a1bd445ccce3b1d2b8cb60240c1858a19ae936e536e39cf79848b5de22f4d438911c8c4384fe8d2b763a9390ee9afc593
|
data/Makefile
CHANGED
@@ -411,8 +411,8 @@ Q = @
|
|
411
411
|
endif
|
412
412
|
|
413
413
|
CORE_VERSION = 5.0.0
|
414
|
-
CPP_VERSION = 1.7.
|
415
|
-
CSHARP_VERSION = 1.7.
|
414
|
+
CPP_VERSION = 1.7.3
|
415
|
+
CSHARP_VERSION = 1.7.3
|
416
416
|
|
417
417
|
CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
|
418
418
|
CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
|
@@ -1117,6 +1117,7 @@ bm_metadata: $(BINDIR)/$(CONFIG)/bm_metadata
|
|
1117
1117
|
bm_pollset: $(BINDIR)/$(CONFIG)/bm_pollset
|
1118
1118
|
channel_arguments_test: $(BINDIR)/$(CONFIG)/channel_arguments_test
|
1119
1119
|
channel_filter_test: $(BINDIR)/$(CONFIG)/channel_filter_test
|
1120
|
+
chttp2_settings_timeout_test: $(BINDIR)/$(CONFIG)/chttp2_settings_timeout_test
|
1120
1121
|
cli_call_test: $(BINDIR)/$(CONFIG)/cli_call_test
|
1121
1122
|
client_crash_test: $(BINDIR)/$(CONFIG)/client_crash_test
|
1122
1123
|
client_crash_test_server: $(BINDIR)/$(CONFIG)/client_crash_test_server
|
@@ -1562,6 +1563,7 @@ buildtests_cxx: privatelibs_cxx \
|
|
1562
1563
|
$(BINDIR)/$(CONFIG)/bm_pollset \
|
1563
1564
|
$(BINDIR)/$(CONFIG)/channel_arguments_test \
|
1564
1565
|
$(BINDIR)/$(CONFIG)/channel_filter_test \
|
1566
|
+
$(BINDIR)/$(CONFIG)/chttp2_settings_timeout_test \
|
1565
1567
|
$(BINDIR)/$(CONFIG)/cli_call_test \
|
1566
1568
|
$(BINDIR)/$(CONFIG)/client_crash_test \
|
1567
1569
|
$(BINDIR)/$(CONFIG)/client_crash_test_server \
|
@@ -1682,6 +1684,7 @@ buildtests_cxx: privatelibs_cxx \
|
|
1682
1684
|
$(BINDIR)/$(CONFIG)/bm_pollset \
|
1683
1685
|
$(BINDIR)/$(CONFIG)/channel_arguments_test \
|
1684
1686
|
$(BINDIR)/$(CONFIG)/channel_filter_test \
|
1687
|
+
$(BINDIR)/$(CONFIG)/chttp2_settings_timeout_test \
|
1685
1688
|
$(BINDIR)/$(CONFIG)/cli_call_test \
|
1686
1689
|
$(BINDIR)/$(CONFIG)/client_crash_test \
|
1687
1690
|
$(BINDIR)/$(CONFIG)/client_crash_test_server \
|
@@ -2071,6 +2074,8 @@ test_cxx: buildtests_cxx
|
|
2071
2074
|
$(Q) $(BINDIR)/$(CONFIG)/channel_arguments_test || ( echo test channel_arguments_test failed ; exit 1 )
|
2072
2075
|
$(E) "[RUN] Testing channel_filter_test"
|
2073
2076
|
$(Q) $(BINDIR)/$(CONFIG)/channel_filter_test || ( echo test channel_filter_test failed ; exit 1 )
|
2077
|
+
$(E) "[RUN] Testing chttp2_settings_timeout_test"
|
2078
|
+
$(Q) $(BINDIR)/$(CONFIG)/chttp2_settings_timeout_test || ( echo test chttp2_settings_timeout_test failed ; exit 1 )
|
2074
2079
|
$(E) "[RUN] Testing cli_call_test"
|
2075
2080
|
$(Q) $(BINDIR)/$(CONFIG)/cli_call_test || ( echo test cli_call_test failed ; exit 1 )
|
2076
2081
|
$(E) "[RUN] Testing client_crash_test"
|
@@ -14494,6 +14499,49 @@ endif
|
|
14494
14499
|
endif
|
14495
14500
|
|
14496
14501
|
|
14502
|
+
CHTTP2_SETTINGS_TIMEOUT_TEST_SRC = \
|
14503
|
+
test/core/transport/chttp2/settings_timeout_test.cc \
|
14504
|
+
|
14505
|
+
CHTTP2_SETTINGS_TIMEOUT_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CHTTP2_SETTINGS_TIMEOUT_TEST_SRC))))
|
14506
|
+
ifeq ($(NO_SECURE),true)
|
14507
|
+
|
14508
|
+
# You can't build secure targets if you don't have OpenSSL.
|
14509
|
+
|
14510
|
+
$(BINDIR)/$(CONFIG)/chttp2_settings_timeout_test: openssl_dep_error
|
14511
|
+
|
14512
|
+
else
|
14513
|
+
|
14514
|
+
|
14515
|
+
|
14516
|
+
|
14517
|
+
ifeq ($(NO_PROTOBUF),true)
|
14518
|
+
|
14519
|
+
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
|
14520
|
+
|
14521
|
+
$(BINDIR)/$(CONFIG)/chttp2_settings_timeout_test: protobuf_dep_error
|
14522
|
+
|
14523
|
+
else
|
14524
|
+
|
14525
|
+
$(BINDIR)/$(CONFIG)/chttp2_settings_timeout_test: $(PROTOBUF_DEP) $(CHTTP2_SETTINGS_TIMEOUT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
|
14526
|
+
$(E) "[LD] Linking $@"
|
14527
|
+
$(Q) mkdir -p `dirname $@`
|
14528
|
+
$(Q) $(LDXX) $(LDFLAGS) $(CHTTP2_SETTINGS_TIMEOUT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/chttp2_settings_timeout_test
|
14529
|
+
|
14530
|
+
endif
|
14531
|
+
|
14532
|
+
endif
|
14533
|
+
|
14534
|
+
$(OBJDIR)/$(CONFIG)/test/core/transport/chttp2/settings_timeout_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
|
14535
|
+
|
14536
|
+
deps_chttp2_settings_timeout_test: $(CHTTP2_SETTINGS_TIMEOUT_TEST_OBJS:.o=.dep)
|
14537
|
+
|
14538
|
+
ifneq ($(NO_SECURE),true)
|
14539
|
+
ifneq ($(NO_DEPS),true)
|
14540
|
+
-include $(CHTTP2_SETTINGS_TIMEOUT_TEST_OBJS:.o=.dep)
|
14541
|
+
endif
|
14542
|
+
endif
|
14543
|
+
|
14544
|
+
|
14497
14545
|
CLI_CALL_TEST_SRC = \
|
14498
14546
|
test/cpp/util/cli_call_test.cc \
|
14499
14547
|
|
@@ -240,6 +240,9 @@ typedef struct {
|
|
240
240
|
/** The time between the first and second connection attempts, in ms */
|
241
241
|
#define GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS \
|
242
242
|
"grpc.initial_reconnect_backoff_ms"
|
243
|
+
/** The timeout used on servers for finishing handshaking on an incoming
|
244
|
+
connection. Defaults to 120 seconds. */
|
245
|
+
#define GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS "grpc.server_handshake_timeout_ms"
|
243
246
|
/** This *should* be used for testing only.
|
244
247
|
The caller of the secure_channel_create functions may override the target
|
245
248
|
name used for SSL host name checking using this channel argument which is of
|
@@ -115,11 +115,35 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
|
|
115
115
|
}
|
116
116
|
memset(c->result, 0, sizeof(*c->result));
|
117
117
|
} else {
|
118
|
-
c->result->transport =
|
119
|
-
|
118
|
+
c->result->transport = grpc_create_chttp2_transport(exec_ctx, args->args,
|
119
|
+
args->endpoint, true);
|
120
120
|
GPR_ASSERT(c->result->transport);
|
121
|
+
// TODO(roth): We ideally want to wait until we receive HTTP/2
|
122
|
+
// settings from the server before we consider the connection
|
123
|
+
// established. If that doesn't happen before the connection
|
124
|
+
// timeout expires, then we should consider the connection attempt a
|
125
|
+
// failure and feed that information back into the backoff code.
|
126
|
+
// We could pass a notify_on_receive_settings callback to
|
127
|
+
// grpc_chttp2_transport_start_reading() to let us know when
|
128
|
+
// settings are received, but we would need to figure out how to use
|
129
|
+
// that information here.
|
130
|
+
//
|
131
|
+
// Unfortunately, we don't currently have a way to split apart the two
|
132
|
+
// effects of scheduling c->notify: we start sending RPCs immediately
|
133
|
+
// (which we want to do) and we consider the connection attempt successful
|
134
|
+
// (which we don't want to do until we get the notify_on_receive_settings
|
135
|
+
// callback from the transport). If we could split those things
|
136
|
+
// apart, then we could start sending RPCs but then wait for our
|
137
|
+
// timeout before deciding if the connection attempt is successful.
|
138
|
+
// If the attempt is not successful, then we would tear down the
|
139
|
+
// transport and feed the failure back into the backoff code.
|
140
|
+
//
|
141
|
+
// In addition, even if we did that, we would probably not want to do
|
142
|
+
// so until after transparent retries is implemented. Otherwise, any
|
143
|
+
// RPC that we attempt to send on the connection before the timeout
|
144
|
+
// would fail instead of being retried on a subsequent attempt.
|
121
145
|
grpc_chttp2_transport_start_reading(exec_ctx, c->result->transport,
|
122
|
-
args->read_buffer);
|
146
|
+
args->read_buffer, NULL);
|
123
147
|
c->result->channel_args = args->args;
|
124
148
|
}
|
125
149
|
grpc_closure *notify = c->notify;
|
@@ -53,12 +53,12 @@ grpc_channel *grpc_insecure_channel_create_from_fd(
|
|
53
53
|
&exec_ctx, grpc_fd_create(fd, "client"), args, "fd-client");
|
54
54
|
|
55
55
|
grpc_transport *transport =
|
56
|
-
grpc_create_chttp2_transport(&exec_ctx, final_args, client,
|
56
|
+
grpc_create_chttp2_transport(&exec_ctx, final_args, client, true);
|
57
57
|
GPR_ASSERT(transport);
|
58
58
|
grpc_channel *channel = grpc_channel_create(
|
59
59
|
&exec_ctx, target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport);
|
60
60
|
grpc_channel_args_destroy(&exec_ctx, final_args);
|
61
|
-
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
|
61
|
+
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, NULL);
|
62
62
|
|
63
63
|
grpc_exec_ctx_finish(&exec_ctx);
|
64
64
|
|
@@ -20,6 +20,7 @@
|
|
20
20
|
|
21
21
|
#include <grpc/grpc.h>
|
22
22
|
|
23
|
+
#include <limits.h>
|
23
24
|
#include <string.h>
|
24
25
|
|
25
26
|
#include <grpc/support/alloc.h>
|
@@ -30,6 +31,7 @@
|
|
30
31
|
|
31
32
|
#include "src/core/ext/filters/http/server/http_server_filter.h"
|
32
33
|
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
|
34
|
+
#include "src/core/ext/transport/chttp2/transport/internal.h"
|
33
35
|
#include "src/core/lib/channel/channel_args.h"
|
34
36
|
#include "src/core/lib/channel/handshaker.h"
|
35
37
|
#include "src/core/lib/channel/handshaker_registry.h"
|
@@ -52,12 +54,52 @@ typedef struct {
|
|
52
54
|
} server_state;
|
53
55
|
|
54
56
|
typedef struct {
|
57
|
+
gpr_refcount refs;
|
55
58
|
server_state *svr_state;
|
56
59
|
grpc_pollset *accepting_pollset;
|
57
60
|
grpc_tcp_server_acceptor *acceptor;
|
58
61
|
grpc_handshake_manager *handshake_mgr;
|
62
|
+
// State for enforcing handshake timeout on receiving HTTP/2 settings.
|
63
|
+
grpc_chttp2_transport *transport;
|
64
|
+
gpr_timespec deadline;
|
65
|
+
grpc_timer timer;
|
66
|
+
grpc_closure on_timeout;
|
67
|
+
grpc_closure on_receive_settings;
|
59
68
|
} server_connection_state;
|
60
69
|
|
70
|
+
static void server_connection_state_unref(
|
71
|
+
grpc_exec_ctx *exec_ctx, server_connection_state *connection_state) {
|
72
|
+
if (gpr_unref(&connection_state->refs)) {
|
73
|
+
if (connection_state->transport != NULL) {
|
74
|
+
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, connection_state->transport,
|
75
|
+
"receive settings timeout");
|
76
|
+
}
|
77
|
+
gpr_free(connection_state);
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
static void on_timeout(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
82
|
+
server_connection_state *connection_state = (server_connection_state *)arg;
|
83
|
+
// Note that we may be called with GRPC_ERROR_NONE when the timer fires
|
84
|
+
// or with an error indicating that the timer system is being shut down.
|
85
|
+
if (error != GRPC_ERROR_CANCELLED) {
|
86
|
+
grpc_transport_op *op = grpc_make_transport_op(NULL);
|
87
|
+
op->disconnect_with_error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
88
|
+
"Did not receive HTTP/2 settings before handshake timeout");
|
89
|
+
grpc_transport_perform_op(exec_ctx, &connection_state->transport->base, op);
|
90
|
+
}
|
91
|
+
server_connection_state_unref(exec_ctx, connection_state);
|
92
|
+
}
|
93
|
+
|
94
|
+
static void on_receive_settings(grpc_exec_ctx *exec_ctx, void *arg,
|
95
|
+
grpc_error *error) {
|
96
|
+
server_connection_state *connection_state = (server_connection_state *)arg;
|
97
|
+
if (error == GRPC_ERROR_NONE) {
|
98
|
+
grpc_timer_cancel(exec_ctx, &connection_state->timer);
|
99
|
+
}
|
100
|
+
server_connection_state_unref(exec_ctx, connection_state);
|
101
|
+
}
|
102
|
+
|
61
103
|
static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
|
62
104
|
grpc_error *error) {
|
63
105
|
grpc_handshaker_args *args = (grpc_handshaker_args *)arg;
|
@@ -67,7 +109,6 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
|
|
67
109
|
if (error != GRPC_ERROR_NONE || connection_state->svr_state->shutdown) {
|
68
110
|
const char *error_str = grpc_error_string(error);
|
69
111
|
gpr_log(GPR_DEBUG, "Handshaking failed: %s", error_str);
|
70
|
-
|
71
112
|
if (error == GRPC_ERROR_NONE && args->endpoint != NULL) {
|
72
113
|
// We were shut down after handshaking completed successfully, so
|
73
114
|
// destroy the endpoint here.
|
@@ -86,14 +127,30 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
|
|
86
127
|
// handshaker may have handed off the connection to some external
|
87
128
|
// code, so we can just clean up here without creating a transport.
|
88
129
|
if (args->endpoint != NULL) {
|
89
|
-
grpc_transport *transport =
|
90
|
-
|
130
|
+
grpc_transport *transport = grpc_create_chttp2_transport(
|
131
|
+
exec_ctx, args->args, args->endpoint, false);
|
91
132
|
grpc_server_setup_transport(
|
92
133
|
exec_ctx, connection_state->svr_state->server, transport,
|
93
134
|
connection_state->accepting_pollset, args->args);
|
94
|
-
|
95
|
-
|
135
|
+
// Use notify_on_receive_settings callback to enforce the
|
136
|
+
// handshake deadline.
|
137
|
+
connection_state->transport = (grpc_chttp2_transport *)transport;
|
138
|
+
gpr_ref(&connection_state->refs);
|
139
|
+
GRPC_CLOSURE_INIT(&connection_state->on_receive_settings,
|
140
|
+
on_receive_settings, connection_state,
|
141
|
+
grpc_schedule_on_exec_ctx);
|
142
|
+
grpc_chttp2_transport_start_reading(
|
143
|
+
exec_ctx, transport, args->read_buffer,
|
144
|
+
&connection_state->on_receive_settings);
|
96
145
|
grpc_channel_args_destroy(exec_ctx, args->args);
|
146
|
+
gpr_ref(&connection_state->refs);
|
147
|
+
GRPC_CHTTP2_REF_TRANSPORT((grpc_chttp2_transport *)transport,
|
148
|
+
"receive settings timeout");
|
149
|
+
GRPC_CLOSURE_INIT(&connection_state->on_timeout, on_timeout,
|
150
|
+
connection_state, grpc_schedule_on_exec_ctx);
|
151
|
+
grpc_timer_init(exec_ctx, &connection_state->timer,
|
152
|
+
connection_state->deadline, &connection_state->on_timeout,
|
153
|
+
gpr_now(GPR_CLOCK_MONOTONIC));
|
97
154
|
}
|
98
155
|
}
|
99
156
|
grpc_handshake_manager_pending_list_remove(
|
@@ -101,9 +158,9 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
|
|
101
158
|
connection_state->handshake_mgr);
|
102
159
|
gpr_mu_unlock(&connection_state->svr_state->mu);
|
103
160
|
grpc_handshake_manager_destroy(exec_ctx, connection_state->handshake_mgr);
|
104
|
-
grpc_tcp_server_unref(exec_ctx, connection_state->svr_state->tcp_server);
|
105
161
|
gpr_free(connection_state->acceptor);
|
106
|
-
|
162
|
+
grpc_tcp_server_unref(exec_ctx, connection_state->svr_state->tcp_server);
|
163
|
+
server_connection_state_unref(exec_ctx, connection_state);
|
107
164
|
}
|
108
165
|
|
109
166
|
static void on_accept(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
|
@@ -124,19 +181,26 @@ static void on_accept(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
|
|
124
181
|
gpr_mu_unlock(&state->mu);
|
125
182
|
grpc_tcp_server_ref(state->tcp_server);
|
126
183
|
server_connection_state *connection_state =
|
127
|
-
(server_connection_state *)
|
184
|
+
(server_connection_state *)gpr_zalloc(sizeof(*connection_state));
|
185
|
+
gpr_ref_init(&connection_state->refs, 1);
|
128
186
|
connection_state->svr_state = state;
|
129
187
|
connection_state->accepting_pollset = accepting_pollset;
|
130
188
|
connection_state->acceptor = acceptor;
|
131
189
|
connection_state->handshake_mgr = handshake_mgr;
|
132
190
|
grpc_handshakers_add(exec_ctx, HANDSHAKER_SERVER, state->args,
|
133
191
|
connection_state->handshake_mgr);
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
gpr_now(GPR_CLOCK_MONOTONIC),
|
192
|
+
const grpc_arg *timeout_arg =
|
193
|
+
grpc_channel_args_find(state->args, GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS);
|
194
|
+
connection_state->deadline = gpr_time_add(
|
195
|
+
gpr_now(GPR_CLOCK_MONOTONIC),
|
196
|
+
gpr_time_from_millis(
|
197
|
+
grpc_channel_arg_get_integer(
|
198
|
+
timeout_arg,
|
199
|
+
(grpc_integer_options){120 * GPR_MS_PER_SEC, 1, INT_MAX}),
|
200
|
+
GPR_TIMESPAN));
|
138
201
|
grpc_handshake_manager_do_handshake(exec_ctx, connection_state->handshake_mgr,
|
139
|
-
tcp, state->args,
|
202
|
+
tcp, state->args,
|
203
|
+
connection_state->deadline, acceptor,
|
140
204
|
on_handshake_done, connection_state);
|
141
205
|
}
|
142
206
|
|
@@ -50,7 +50,7 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server,
|
|
50
50
|
|
51
51
|
const grpc_channel_args *server_args = grpc_server_get_channel_args(server);
|
52
52
|
grpc_transport *transport = grpc_create_chttp2_transport(
|
53
|
-
&exec_ctx, server_args, server_endpoint,
|
53
|
+
&exec_ctx, server_args, server_endpoint, false /* is_client */);
|
54
54
|
|
55
55
|
grpc_pollset **pollsets;
|
56
56
|
size_t num_pollsets = 0;
|
@@ -61,7 +61,7 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server,
|
|
61
61
|
}
|
62
62
|
|
63
63
|
grpc_server_setup_transport(&exec_ctx, server, transport, NULL, server_args);
|
64
|
-
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
|
64
|
+
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, NULL);
|
65
65
|
grpc_exec_ctx_finish(&exec_ctx);
|
66
66
|
}
|
67
67
|
|
@@ -663,6 +663,11 @@ static void close_transport_locked(grpc_exec_ctx *exec_ctx,
|
|
663
663
|
end_all_the_calls(exec_ctx, t, GRPC_ERROR_REF(error));
|
664
664
|
cancel_pings(exec_ctx, t, GRPC_ERROR_REF(error));
|
665
665
|
}
|
666
|
+
if (t->notify_on_receive_settings != NULL) {
|
667
|
+
GRPC_CLOSURE_SCHED(exec_ctx, t->notify_on_receive_settings,
|
668
|
+
GRPC_ERROR_CANCELLED);
|
669
|
+
t->notify_on_receive_settings = NULL;
|
670
|
+
}
|
666
671
|
GRPC_ERROR_UNREF(error);
|
667
672
|
}
|
668
673
|
|
@@ -1802,7 +1807,6 @@ static void perform_transport_op_locked(grpc_exec_ctx *exec_ctx,
|
|
1802
1807
|
grpc_transport_op *op = (grpc_transport_op *)stream_op;
|
1803
1808
|
grpc_chttp2_transport *t =
|
1804
1809
|
(grpc_chttp2_transport *)op->handler_private.extra_arg;
|
1805
|
-
grpc_error *close_transport = op->disconnect_with_error;
|
1806
1810
|
|
1807
1811
|
if (op->goaway_error) {
|
1808
1812
|
send_goaway(exec_ctx, t, op->goaway_error);
|
@@ -1834,8 +1838,8 @@ static void perform_transport_op_locked(grpc_exec_ctx *exec_ctx,
|
|
1834
1838
|
op->on_connectivity_state_change);
|
1835
1839
|
}
|
1836
1840
|
|
1837
|
-
if (
|
1838
|
-
close_transport_locked(exec_ctx, t,
|
1841
|
+
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
|
1842
|
+
close_transport_locked(exec_ctx, t, op->disconnect_with_error);
|
1839
1843
|
}
|
1840
1844
|
|
1841
1845
|
GRPC_CLOSURE_RUN(exec_ctx, op->on_consumed, GRPC_ERROR_NONE);
|
@@ -3231,16 +3235,16 @@ static const grpc_transport_vtable *get_vtable(void) { return &vtable; }
|
|
3231
3235
|
|
3232
3236
|
grpc_transport *grpc_create_chttp2_transport(
|
3233
3237
|
grpc_exec_ctx *exec_ctx, const grpc_channel_args *channel_args,
|
3234
|
-
grpc_endpoint *ep,
|
3238
|
+
grpc_endpoint *ep, bool is_client) {
|
3235
3239
|
grpc_chttp2_transport *t =
|
3236
3240
|
(grpc_chttp2_transport *)gpr_zalloc(sizeof(grpc_chttp2_transport));
|
3237
|
-
init_transport(exec_ctx, t, channel_args, ep, is_client
|
3241
|
+
init_transport(exec_ctx, t, channel_args, ep, is_client);
|
3238
3242
|
return &t->base;
|
3239
3243
|
}
|
3240
3244
|
|
3241
|
-
void grpc_chttp2_transport_start_reading(
|
3242
|
-
|
3243
|
-
|
3245
|
+
void grpc_chttp2_transport_start_reading(
|
3246
|
+
grpc_exec_ctx *exec_ctx, grpc_transport *transport,
|
3247
|
+
grpc_slice_buffer *read_buffer, grpc_closure *notify_on_receive_settings) {
|
3244
3248
|
grpc_chttp2_transport *t = (grpc_chttp2_transport *)transport;
|
3245
3249
|
GRPC_CHTTP2_REF_TRANSPORT(
|
3246
3250
|
t, "reading_action"); /* matches unref inside reading_action */
|
@@ -3248,5 +3252,6 @@ void grpc_chttp2_transport_start_reading(grpc_exec_ctx *exec_ctx,
|
|
3248
3252
|
grpc_slice_buffer_move_into(read_buffer, &t->read_buffer);
|
3249
3253
|
gpr_free(read_buffer);
|
3250
3254
|
}
|
3255
|
+
t->notify_on_receive_settings = notify_on_receive_settings;
|
3251
3256
|
GRPC_CLOSURE_SCHED(exec_ctx, &t->read_action_locked, GRPC_ERROR_NONE);
|
3252
3257
|
}
|
@@ -33,12 +33,14 @@ extern grpc_tracer_flag grpc_trace_chttp2_refcount;
|
|
33
33
|
|
34
34
|
grpc_transport *grpc_create_chttp2_transport(
|
35
35
|
grpc_exec_ctx *exec_ctx, const grpc_channel_args *channel_args,
|
36
|
-
grpc_endpoint *ep,
|
36
|
+
grpc_endpoint *ep, bool is_client);
|
37
37
|
|
38
38
|
/// Takes ownership of \a read_buffer, which (if non-NULL) contains
|
39
39
|
/// leftover bytes previously read from the endpoint (e.g., by handshakers).
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
/// If non-null, \a notify_on_receive_settings will be scheduled when
|
41
|
+
/// HTTP/2 settings are received from the peer.
|
42
|
+
void grpc_chttp2_transport_start_reading(
|
43
|
+
grpc_exec_ctx *exec_ctx, grpc_transport *transport,
|
44
|
+
grpc_slice_buffer *read_buffer, grpc_closure *notify_on_receive_settings);
|
43
45
|
|
44
46
|
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H */
|
@@ -131,6 +131,11 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, void *p,
|
|
131
131
|
memcpy(parser->target_settings, parser->incoming_settings,
|
132
132
|
GRPC_CHTTP2_NUM_SETTINGS * sizeof(uint32_t));
|
133
133
|
grpc_slice_buffer_add(&t->qbuf, grpc_chttp2_settings_ack_create());
|
134
|
+
if (t->notify_on_receive_settings != NULL) {
|
135
|
+
GRPC_CLOSURE_SCHED(exec_ctx, t->notify_on_receive_settings,
|
136
|
+
GRPC_ERROR_NONE);
|
137
|
+
t->notify_on_receive_settings = NULL;
|
138
|
+
}
|
134
139
|
}
|
135
140
|
return GRPC_ERROR_NONE;
|
136
141
|
}
|
@@ -287,6 +287,8 @@ struct grpc_chttp2_transport {
|
|
287
287
|
|
288
288
|
grpc_combiner *combiner;
|
289
289
|
|
290
|
+
grpc_closure *notify_on_receive_settings;
|
291
|
+
|
290
292
|
/** write execution state of the transport */
|
291
293
|
grpc_chttp2_write_state write_state;
|
292
294
|
/** is this the first write in a series of writes?
|
@@ -333,9 +333,6 @@ void grpc_transport_ping(grpc_transport *transport, grpc_closure *cb);
|
|
333
333
|
void grpc_transport_goaway(grpc_transport *transport, grpc_status_code status,
|
334
334
|
grpc_slice debug_data);
|
335
335
|
|
336
|
-
/* Close a transport. Aborts all open streams. */
|
337
|
-
void grpc_transport_close(grpc_transport *transport);
|
338
|
-
|
339
336
|
/* Destroy the transport */
|
340
337
|
void grpc_transport_destroy(grpc_exec_ctx *exec_ctx, grpc_transport *transport);
|
341
338
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gRPC Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: src/ruby/bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -1459,7 +1459,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1459
1459
|
version: '0'
|
1460
1460
|
requirements: []
|
1461
1461
|
rubyforge_project:
|
1462
|
-
rubygems_version: 2.
|
1462
|
+
rubygems_version: 2.7.3
|
1463
1463
|
signing_key:
|
1464
1464
|
specification_version: 4
|
1465
1465
|
summary: GRPC system in Ruby
|