grpc 1.11.1 → 1.12.0
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 +4 -4
- data/Makefile +225 -87
- data/etc/roots.pem +0 -33
- data/include/grpc/grpc_security.h +70 -0
- data/include/grpc/impl/codegen/port_platform.h +11 -0
- data/include/grpc/support/log.h +9 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +305 -210
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy.h +4 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +12 -9
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +168 -197
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +368 -373
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +498 -98
- data/src/core/ext/filters/client_channel/method_params.h +4 -0
- data/src/core/ext/filters/client_channel/resolver.h +4 -0
- data/src/core/ext/filters/client_channel/retry_throttle.h +4 -0
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +40 -15
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +5 -5
- data/src/core/ext/transport/inproc/inproc_transport.cc +41 -43
- data/src/core/lib/channel/channel_args.cc +28 -0
- data/src/core/lib/channel/channel_args.h +4 -0
- data/src/core/lib/channel/handshaker.cc +47 -0
- data/src/core/lib/channel/handshaker.h +4 -0
- data/src/core/lib/debug/trace.cc +2 -1
- data/src/core/lib/debug/trace.h +10 -1
- data/src/core/lib/gpr/log.cc +8 -2
- data/src/core/lib/gpr/log_android.cc +4 -0
- data/src/core/lib/gpr/log_linux.cc +4 -0
- data/src/core/lib/gpr/log_posix.cc +4 -0
- data/src/core/lib/gpr/log_windows.cc +5 -0
- data/src/core/lib/gprpp/inlined_vector.h +30 -34
- data/src/core/lib/gprpp/orphanable.h +4 -4
- data/src/core/lib/gprpp/ref_counted.h +4 -4
- data/src/core/lib/iomgr/call_combiner.cc +13 -13
- data/src/core/lib/iomgr/closure.h +3 -3
- data/src/core/lib/iomgr/combiner.cc +11 -11
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +24 -24
- data/src/core/lib/iomgr/ev_epollex_linux.cc +48 -29
- data/src/core/lib/iomgr/ev_epollsig_linux.cc +2 -2
- data/src/core/lib/iomgr/ev_poll_posix.cc +9 -3
- data/src/core/lib/iomgr/ev_posix.cc +3 -3
- data/src/core/lib/iomgr/executor.cc +6 -6
- data/src/core/lib/iomgr/resource_quota.cc +10 -11
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +24 -0
- data/src/core/lib/iomgr/socket_utils_linux.cc +0 -1
- data/src/core/lib/iomgr/socket_utils_posix.cc +2 -3
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_client_custom.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -4
- data/src/core/lib/iomgr/tcp_custom.cc +10 -10
- data/src/core/lib/iomgr/tcp_posix.cc +25 -25
- data/src/core/lib/iomgr/tcp_server_custom.cc +5 -5
- data/src/core/lib/iomgr/tcp_server_posix.cc +4 -25
- data/src/core/lib/iomgr/tcp_server_windows.cc +1 -0
- data/src/core/lib/iomgr/tcp_uv.cc +3 -0
- data/src/core/lib/iomgr/tcp_windows.cc +16 -0
- data/src/core/lib/iomgr/timer_generic.cc +27 -17
- data/src/core/lib/iomgr/timer_manager.cc +11 -12
- data/src/core/lib/iomgr/timer_uv.cc +3 -0
- data/src/core/lib/iomgr/udp_server.cc +104 -49
- data/src/core/lib/iomgr/udp_server.h +8 -4
- data/src/core/lib/profiling/basic_timers.cc +1 -0
- data/src/core/lib/security/credentials/alts/alts_credentials.h +0 -20
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +7 -7
- data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +1 -38
- data/src/core/lib/security/security_connector/security_connector.cc +19 -16
- data/src/core/lib/security/security_connector/security_connector.h +4 -3
- data/src/core/lib/security/transport/secure_endpoint.cc +2 -2
- data/src/core/lib/security/transport/security_handshaker.cc +6 -2
- data/src/core/lib/slice/slice.cc +6 -2
- data/src/core/lib/slice/slice_buffer.cc +12 -4
- data/src/core/lib/slice/slice_hash_table.h +4 -0
- data/src/core/lib/slice/slice_weak_hash_table.h +4 -0
- data/src/core/lib/surface/call.cc +6 -6
- data/src/core/lib/surface/server.cc +16 -0
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/bdp_estimator.cc +3 -3
- data/src/core/lib/transport/bdp_estimator.h +2 -2
- data/src/core/lib/transport/connectivity_state.cc +6 -7
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +14 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +21 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +7 -1
- data/src/ruby/spec/pb/package_with_underscore/checker_spec.rb +2 -5
- data/third_party/address_sorting/address_sorting.c +10 -9
- metadata +27 -28
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +0 -253
@@ -86,17 +86,21 @@ int grpc_udp_server_get_fd(grpc_udp_server* s, unsigned port_index);
|
|
86
86
|
/* Add a port to the server, returning port number on success, or negative
|
87
87
|
on failure.
|
88
88
|
|
89
|
+
Create |num_listeners| sockets for given address to listen on using
|
90
|
+
SO_REUSEPORT if supported.
|
91
|
+
|
89
92
|
The :: and 0.0.0.0 wildcard addresses are treated identically, accepting
|
90
|
-
both IPv4 and IPv6 connections, but :: is the preferred style.
|
91
|
-
creates
|
92
|
-
but not dualstack sockets. */
|
93
|
+
both IPv4 and IPv6 connections, but :: is the preferred style. This usually
|
94
|
+
creates |num_listeners| sockets, but possibly 2 * |num_listeners| on systems
|
95
|
+
which support IPv6, but not dualstack sockets. */
|
93
96
|
|
94
97
|
/* TODO(ctiller): deprecate this, and make grpc_udp_server_add_ports to handle
|
95
98
|
all of the multiple socket port matching logic in one place */
|
96
99
|
int grpc_udp_server_add_port(grpc_udp_server* s,
|
97
100
|
const grpc_resolved_address* addr,
|
98
101
|
int rcv_buf_size, int snd_buf_size,
|
99
|
-
GrpcUdpHandlerFactory* handler_factory
|
102
|
+
GrpcUdpHandlerFactory* handler_factory,
|
103
|
+
size_t num_listeners);
|
100
104
|
|
101
105
|
void grpc_udp_server_destroy(grpc_udp_server* server, grpc_closure* on_done);
|
102
106
|
|
@@ -40,26 +40,6 @@ typedef struct grpc_alts_server_credentials {
|
|
40
40
|
char* handshaker_service_url;
|
41
41
|
} grpc_alts_server_credentials;
|
42
42
|
|
43
|
-
/**
|
44
|
-
* This method creates an ALTS channel credential object.
|
45
|
-
*
|
46
|
-
* - options: grpc ALTS credentials options instance for client.
|
47
|
-
*
|
48
|
-
* It returns the created ALTS channel credential object.
|
49
|
-
*/
|
50
|
-
grpc_channel_credentials* grpc_alts_credentials_create(
|
51
|
-
const grpc_alts_credentials_options* options);
|
52
|
-
|
53
|
-
/**
|
54
|
-
* This method creates an ALTS server credential object.
|
55
|
-
*
|
56
|
-
* - options: grpc ALTS credentials options instance for server.
|
57
|
-
*
|
58
|
-
* It returns the created ALTS server credential object.
|
59
|
-
*/
|
60
|
-
grpc_server_credentials* grpc_alts_server_credentials_create(
|
61
|
-
const grpc_alts_credentials_options* options);
|
62
|
-
|
63
43
|
/**
|
64
44
|
* This method creates an ALTS channel credential object with customized
|
65
45
|
* information provided by caller.
|
@@ -44,20 +44,20 @@ static target_service_account* target_service_account_create(
|
|
44
44
|
return sa;
|
45
45
|
}
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
const char* service_account) {
|
47
|
+
void grpc_alts_credentials_client_options_add_target_service_account(
|
48
|
+
grpc_alts_credentials_options* options, const char* service_account) {
|
50
49
|
if (options == nullptr || service_account == nullptr) {
|
51
50
|
gpr_log(
|
52
51
|
GPR_ERROR,
|
53
52
|
"Invalid nullptr arguments to "
|
54
53
|
"grpc_alts_credentials_client_options_add_target_service_account()");
|
55
|
-
return
|
54
|
+
return;
|
56
55
|
}
|
56
|
+
auto client_options =
|
57
|
+
reinterpret_cast<grpc_alts_credentials_client_options*>(options);
|
57
58
|
target_service_account* node = target_service_account_create(service_account);
|
58
|
-
node->next =
|
59
|
-
|
60
|
-
return true;
|
59
|
+
node->next = client_options->target_account_list_head;
|
60
|
+
client_options->target_account_list_head = node;
|
61
61
|
}
|
62
62
|
|
63
63
|
static void target_service_account_destroy(
|
@@ -21,19 +21,10 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
-
#include <
|
24
|
+
#include <grpc/grpc_security.h>
|
25
25
|
|
26
26
|
#include "src/core/tsi/alts/handshaker/transport_security_common_api.h"
|
27
27
|
|
28
|
-
/**
|
29
|
-
* Main interface for ALTS credentials options. The options will contain
|
30
|
-
* information that will be passed from grpc to TSI layer such as RPC protocol
|
31
|
-
* versions. ALTS client (channel) and server credentials will have their own
|
32
|
-
* implementation of this interface. The APIs listed in this header are
|
33
|
-
* thread-compatible.
|
34
|
-
*/
|
35
|
-
typedef struct grpc_alts_credentials_options grpc_alts_credentials_options;
|
36
|
-
|
37
28
|
/* V-table for grpc_alts_credentials_options */
|
38
29
|
typedef struct grpc_alts_credentials_options_vtable {
|
39
30
|
grpc_alts_credentials_options* (*copy)(
|
@@ -80,33 +71,5 @@ typedef struct grpc_alts_credentials_server_options {
|
|
80
71
|
grpc_alts_credentials_options* grpc_alts_credentials_options_copy(
|
81
72
|
const grpc_alts_credentials_options* options);
|
82
73
|
|
83
|
-
/**
|
84
|
-
* This method destroys a grpc_alts_credentials_options instance by
|
85
|
-
* de-allocating all of its occupied memory.
|
86
|
-
*
|
87
|
-
* - options: a grpc_alts_credentials_options instance that needs to be
|
88
|
-
* destroyed.
|
89
|
-
*/
|
90
|
-
void grpc_alts_credentials_options_destroy(
|
91
|
-
grpc_alts_credentials_options* options);
|
92
|
-
|
93
|
-
/* This method creates a grpc ALTS credentials client options instance. */
|
94
|
-
grpc_alts_credentials_options* grpc_alts_credentials_client_options_create();
|
95
|
-
|
96
|
-
/* This method creates a grpc ALTS credentials server options instance. */
|
97
|
-
grpc_alts_credentials_options* grpc_alts_credentials_server_options_create();
|
98
|
-
|
99
|
-
/**
|
100
|
-
* This method adds a target service account to grpc ALTS credentials client
|
101
|
-
* options instance.
|
102
|
-
*
|
103
|
-
* - options: grpc ALTS credentials client options instance.
|
104
|
-
* - service_account: service account of target endpoint.
|
105
|
-
*
|
106
|
-
* It returns true on success and false on failure.
|
107
|
-
*/
|
108
|
-
bool grpc_alts_credentials_client_options_add_target_service_account(
|
109
|
-
grpc_alts_credentials_client_options* options, const char* service_account);
|
110
|
-
|
111
74
|
#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_ALTS_GRPC_ALTS_CREDENTIALS_OPTIONS_H \
|
112
75
|
*/
|
@@ -786,23 +786,26 @@ static void ssl_server_add_handshakers(grpc_server_security_connector* sc,
|
|
786
786
|
tsi_create_adapter_handshaker(tsi_hs), &sc->base));
|
787
787
|
}
|
788
788
|
|
789
|
-
|
789
|
+
int grpc_ssl_host_matches_name(const tsi_peer* peer, const char* peer_name) {
|
790
790
|
char* allocated_name = nullptr;
|
791
791
|
int r;
|
792
792
|
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
793
|
+
char* ignored_port;
|
794
|
+
gpr_split_host_port(peer_name, &allocated_name, &ignored_port);
|
795
|
+
gpr_free(ignored_port);
|
796
|
+
peer_name = allocated_name;
|
797
|
+
if (!peer_name) return 0;
|
798
|
+
|
799
|
+
// IPv6 zone-id should not be included in comparisons.
|
800
|
+
char* const zone_id = strchr(allocated_name, '%');
|
801
|
+
if (zone_id != nullptr) *zone_id = '\0';
|
802
|
+
|
800
803
|
r = tsi_ssl_peer_matches_name(peer, peer_name);
|
801
804
|
gpr_free(allocated_name);
|
802
805
|
return r;
|
803
806
|
}
|
804
807
|
|
805
|
-
grpc_auth_context*
|
808
|
+
grpc_auth_context* grpc_ssl_peer_to_auth_context(const tsi_peer* peer) {
|
806
809
|
size_t i;
|
807
810
|
grpc_auth_context* ctx = nullptr;
|
808
811
|
const char* peer_identity_property_name = nullptr;
|
@@ -859,14 +862,14 @@ static grpc_error* ssl_check_peer(grpc_security_connector* sc,
|
|
859
862
|
}
|
860
863
|
|
861
864
|
/* Check the peer name if specified. */
|
862
|
-
if (peer_name != nullptr && !
|
865
|
+
if (peer_name != nullptr && !grpc_ssl_host_matches_name(peer, peer_name)) {
|
863
866
|
char* msg;
|
864
867
|
gpr_asprintf(&msg, "Peer name %s is not in peer certificate", peer_name);
|
865
868
|
grpc_error* error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
866
869
|
gpr_free(msg);
|
867
870
|
return error;
|
868
871
|
}
|
869
|
-
*auth_context =
|
872
|
+
*auth_context = grpc_ssl_peer_to_auth_context(peer);
|
870
873
|
return GRPC_ERROR_NONE;
|
871
874
|
}
|
872
875
|
|
@@ -924,7 +927,7 @@ static void add_shallow_auth_property_to_peer(tsi_peer* peer,
|
|
924
927
|
tsi_prop->value.length = prop->value_length;
|
925
928
|
}
|
926
929
|
|
927
|
-
tsi_peer
|
930
|
+
tsi_peer grpc_shallow_peer_from_ssl_auth_context(
|
928
931
|
const grpc_auth_context* auth_context) {
|
929
932
|
size_t max_num_props = 0;
|
930
933
|
grpc_auth_property_iterator it;
|
@@ -955,7 +958,7 @@ tsi_peer tsi_shallow_peer_from_ssl_auth_context(
|
|
955
958
|
return peer;
|
956
959
|
}
|
957
960
|
|
958
|
-
void
|
961
|
+
void grpc_shallow_peer_destruct(tsi_peer* peer) {
|
959
962
|
if (peer->properties != nullptr) gpr_free(peer->properties);
|
960
963
|
}
|
961
964
|
|
@@ -967,8 +970,8 @@ static bool ssl_channel_check_call_host(grpc_channel_security_connector* sc,
|
|
967
970
|
grpc_ssl_channel_security_connector* c =
|
968
971
|
reinterpret_cast<grpc_ssl_channel_security_connector*>(sc);
|
969
972
|
grpc_security_status status = GRPC_SECURITY_ERROR;
|
970
|
-
tsi_peer peer =
|
971
|
-
if (
|
973
|
+
tsi_peer peer = grpc_shallow_peer_from_ssl_auth_context(auth_context);
|
974
|
+
if (grpc_ssl_host_matches_name(&peer, host)) status = GRPC_SECURITY_OK;
|
972
975
|
/* If the target name was overridden, then the original target_name was
|
973
976
|
'checked' transitively during the previous peer check at the end of the
|
974
977
|
handshake. */
|
@@ -980,7 +983,7 @@ static bool ssl_channel_check_call_host(grpc_channel_security_connector* sc,
|
|
980
983
|
*error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
981
984
|
"call host does not match SSL server name");
|
982
985
|
}
|
983
|
-
|
986
|
+
grpc_shallow_peer_destruct(&peer);
|
984
987
|
return true;
|
985
988
|
}
|
986
989
|
|
@@ -239,10 +239,11 @@ const tsi_peer_property* tsi_peer_get_property_by_name(const tsi_peer* peer,
|
|
239
239
|
const char* name);
|
240
240
|
|
241
241
|
/* Exposed for testing only. */
|
242
|
-
grpc_auth_context*
|
243
|
-
tsi_peer
|
242
|
+
grpc_auth_context* grpc_ssl_peer_to_auth_context(const tsi_peer* peer);
|
243
|
+
tsi_peer grpc_shallow_peer_from_ssl_auth_context(
|
244
244
|
const grpc_auth_context* auth_context);
|
245
|
-
void
|
245
|
+
void grpc_shallow_peer_destruct(tsi_peer* peer);
|
246
|
+
int grpc_ssl_host_matches_name(const tsi_peer* peer, const char* peer_name);
|
246
247
|
|
247
248
|
/* --- Default SSL Root Store. --- */
|
248
249
|
namespace grpc_core {
|
@@ -133,7 +133,7 @@ static void call_read_cb(secure_endpoint* ep, grpc_error* error) {
|
|
133
133
|
for (i = 0; i < ep->read_buffer->count; i++) {
|
134
134
|
char* data = grpc_dump_slice(ep->read_buffer->slices[i],
|
135
135
|
GPR_DUMP_HEX | GPR_DUMP_ASCII);
|
136
|
-
gpr_log(
|
136
|
+
gpr_log(GPR_INFO, "READ %p: %s", ep, data);
|
137
137
|
gpr_free(data);
|
138
138
|
}
|
139
139
|
}
|
@@ -269,7 +269,7 @@ static void endpoint_write(grpc_endpoint* secure_ep, grpc_slice_buffer* slices,
|
|
269
269
|
for (i = 0; i < slices->count; i++) {
|
270
270
|
char* data =
|
271
271
|
grpc_dump_slice(slices->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII);
|
272
|
-
gpr_log(
|
272
|
+
gpr_log(GPR_INFO, "WRITE %p: %s", ep, data);
|
273
273
|
gpr_free(data);
|
274
274
|
}
|
275
275
|
}
|
@@ -232,6 +232,10 @@ static grpc_error* on_handshake_next_done_locked(
|
|
232
232
|
const unsigned char* bytes_to_send, size_t bytes_to_send_size,
|
233
233
|
tsi_handshaker_result* handshaker_result) {
|
234
234
|
grpc_error* error = GRPC_ERROR_NONE;
|
235
|
+
// Handshaker was shutdown.
|
236
|
+
if (h->shutdown) {
|
237
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Handshaker shutdown");
|
238
|
+
}
|
235
239
|
// Read more if we need to.
|
236
240
|
if (result == TSI_INCOMPLETE_DATA) {
|
237
241
|
GPR_ASSERT(bytes_to_send_size == 0);
|
@@ -406,7 +410,7 @@ static void security_handshaker_do_handshake(grpc_handshaker* handshaker,
|
|
406
410
|
|
407
411
|
static const grpc_handshaker_vtable security_handshaker_vtable = {
|
408
412
|
security_handshaker_destroy, security_handshaker_shutdown,
|
409
|
-
security_handshaker_do_handshake};
|
413
|
+
security_handshaker_do_handshake, "security"};
|
410
414
|
|
411
415
|
static grpc_handshaker* security_handshaker_create(
|
412
416
|
tsi_handshaker* handshaker, grpc_security_connector* connector) {
|
@@ -456,7 +460,7 @@ static void fail_handshaker_do_handshake(grpc_handshaker* handshaker,
|
|
456
460
|
|
457
461
|
static const grpc_handshaker_vtable fail_handshaker_vtable = {
|
458
462
|
fail_handshaker_destroy, fail_handshaker_shutdown,
|
459
|
-
fail_handshaker_do_handshake};
|
463
|
+
fail_handshaker_do_handshake, "security_fail"};
|
460
464
|
|
461
465
|
static grpc_handshaker* fail_handshaker_create() {
|
462
466
|
grpc_handshaker* h = static_cast<grpc_handshaker*>(gpr_malloc(sizeof(*h)));
|
data/src/core/lib/slice/slice.cc
CHANGED
@@ -69,8 +69,12 @@ grpc_slice grpc_slice_ref(grpc_slice slice) {
|
|
69
69
|
|
70
70
|
/* Public API */
|
71
71
|
void grpc_slice_unref(grpc_slice slice) {
|
72
|
-
grpc_core::ExecCtx
|
73
|
-
|
72
|
+
if (grpc_core::ExecCtx::Get() == nullptr) {
|
73
|
+
grpc_core::ExecCtx exec_ctx;
|
74
|
+
grpc_slice_unref_internal(slice);
|
75
|
+
} else {
|
76
|
+
grpc_slice_unref_internal(slice);
|
77
|
+
}
|
74
78
|
}
|
75
79
|
|
76
80
|
/* grpc_slice_from_static_string support structure - a refcount that does
|
@@ -75,8 +75,12 @@ void grpc_slice_buffer_destroy_internal(grpc_slice_buffer* sb) {
|
|
75
75
|
}
|
76
76
|
|
77
77
|
void grpc_slice_buffer_destroy(grpc_slice_buffer* sb) {
|
78
|
-
grpc_core::ExecCtx
|
79
|
-
|
78
|
+
if (grpc_core::ExecCtx::Get() == nullptr) {
|
79
|
+
grpc_core::ExecCtx exec_ctx;
|
80
|
+
grpc_slice_buffer_destroy_internal(sb);
|
81
|
+
} else {
|
82
|
+
grpc_slice_buffer_destroy_internal(sb);
|
83
|
+
}
|
80
84
|
}
|
81
85
|
|
82
86
|
uint8_t* grpc_slice_buffer_tiny_add(grpc_slice_buffer* sb, size_t n) {
|
@@ -176,8 +180,12 @@ void grpc_slice_buffer_reset_and_unref_internal(grpc_slice_buffer* sb) {
|
|
176
180
|
}
|
177
181
|
|
178
182
|
void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer* sb) {
|
179
|
-
grpc_core::ExecCtx
|
180
|
-
|
183
|
+
if (grpc_core::ExecCtx::Get() == nullptr) {
|
184
|
+
grpc_core::ExecCtx exec_ctx;
|
185
|
+
grpc_slice_buffer_reset_and_unref_internal(sb);
|
186
|
+
} else {
|
187
|
+
grpc_slice_buffer_reset_and_unref_internal(sb);
|
188
|
+
}
|
181
189
|
}
|
182
190
|
|
183
191
|
void grpc_slice_buffer_swap(grpc_slice_buffer* a, grpc_slice_buffer* b) {
|
@@ -81,6 +81,10 @@ class SliceHashTable : public RefCounted<SliceHashTable<T>> {
|
|
81
81
|
template <typename T2, typename... Args>
|
82
82
|
friend T2* New(Args&&... args);
|
83
83
|
|
84
|
+
// So Delete() can call our private dtor.
|
85
|
+
template <typename T2>
|
86
|
+
friend void Delete(T2*);
|
87
|
+
|
84
88
|
SliceHashTable(size_t num_entries, Entry* entries, ValueCmp value_cmp);
|
85
89
|
virtual ~SliceHashTable();
|
86
90
|
|
@@ -65,6 +65,10 @@ class SliceWeakHashTable : public RefCounted<SliceWeakHashTable<T, Size>> {
|
|
65
65
|
template <typename T2, typename... Args>
|
66
66
|
friend T2* New(Args&&... args);
|
67
67
|
|
68
|
+
// So Delete() can call our private dtor.
|
69
|
+
template <typename T2>
|
70
|
+
friend void Delete(T2*);
|
71
|
+
|
68
72
|
SliceWeakHashTable() = default;
|
69
73
|
~SliceWeakHashTable() = default;
|
70
74
|
|
@@ -610,7 +610,7 @@ grpc_call_error grpc_call_cancel(grpc_call* call, void* reserved) {
|
|
610
610
|
// This is called via the call combiner to start sending a batch down
|
611
611
|
// the filter stack.
|
612
612
|
static void execute_batch_in_call_combiner(void* arg, grpc_error* ignored) {
|
613
|
-
GPR_TIMER_SCOPE("
|
613
|
+
GPR_TIMER_SCOPE("execute_batch_in_call_combiner", 0);
|
614
614
|
grpc_transport_stream_op_batch* batch =
|
615
615
|
static_cast<grpc_transport_stream_op_batch*>(arg);
|
616
616
|
grpc_call* call = static_cast<grpc_call*>(batch->handler_private.extra_arg);
|
@@ -747,10 +747,10 @@ static void get_final_status(
|
|
747
747
|
status[i] = unpack_received_status(gpr_atm_acq_load(&call->status[i]));
|
748
748
|
}
|
749
749
|
if (grpc_call_error_trace.enabled()) {
|
750
|
-
gpr_log(
|
750
|
+
gpr_log(GPR_INFO, "get_final_status %s", call->is_client ? "CLI" : "SVR");
|
751
751
|
for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
|
752
752
|
if (status[i].is_set) {
|
753
|
-
gpr_log(
|
753
|
+
gpr_log(GPR_INFO, " %d: %s", i, grpc_error_string(status[i].error));
|
754
754
|
}
|
755
755
|
}
|
756
756
|
}
|
@@ -878,8 +878,8 @@ static void set_encodings_accepted_by_peer(grpc_call* call, grpc_mdelem mdel,
|
|
878
878
|
} else {
|
879
879
|
char* accept_encoding_entry_str =
|
880
880
|
grpc_slice_to_c_string(accept_encoding_entry_slice);
|
881
|
-
gpr_log(
|
882
|
-
"
|
881
|
+
gpr_log(GPR_DEBUG,
|
882
|
+
"Unknown entry in accept encoding metadata: '%s'. Ignoring.",
|
883
883
|
accept_encoding_entry_str);
|
884
884
|
gpr_free(accept_encoding_entry_str);
|
885
885
|
}
|
@@ -1539,7 +1539,7 @@ static void free_no_op_completion(void* p, grpc_cq_completion* completion) {
|
|
1539
1539
|
static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops,
|
1540
1540
|
size_t nops, void* notify_tag,
|
1541
1541
|
int is_notify_tag_closure) {
|
1542
|
-
GPR_TIMER_SCOPE("
|
1542
|
+
GPR_TIMER_SCOPE("call_start_batch", 0);
|
1543
1543
|
|
1544
1544
|
size_t i;
|
1545
1545
|
const grpc_op* op;
|
@@ -1161,6 +1161,22 @@ static void listener_destroy_done(void* s, grpc_error* error) {
|
|
1161
1161
|
gpr_mu_unlock(&server->mu_global);
|
1162
1162
|
}
|
1163
1163
|
|
1164
|
+
/*
|
1165
|
+
- Kills all pending requests-for-incoming-RPC-calls (i.e the requests made via
|
1166
|
+
grpc_server_request_call and grpc_server_request_registered call will now be
|
1167
|
+
cancelled). See 'kill_pending_work_locked()'
|
1168
|
+
|
1169
|
+
- Shuts down the listeners (i.e the server will no longer listen on the port
|
1170
|
+
for new incoming channels).
|
1171
|
+
|
1172
|
+
- Iterates through all channels on the server and sends shutdown msg (see
|
1173
|
+
'channel_broadcaster_shutdown()' for details) to the clients via the
|
1174
|
+
transport layer. The transport layer then guarantees the following:
|
1175
|
+
-- Sends shutdown to the client (for eg: HTTP2 transport sends GOAWAY)
|
1176
|
+
-- If the server has outstanding calls that are in the process, the
|
1177
|
+
connection is NOT closed until the server is done with all those calls
|
1178
|
+
-- Once, there are no more calls in progress, the channel is closed
|
1179
|
+
*/
|
1164
1180
|
void grpc_server_shutdown_and_notify(grpc_server* server,
|
1165
1181
|
grpc_completion_queue* cq, void* tag) {
|
1166
1182
|
listener* l;
|
@@ -47,7 +47,7 @@ grpc_millis BdpEstimator::CompletePing() {
|
|
47
47
|
double bw = dt > 0 ? (static_cast<double>(accumulator_) / dt) : 0;
|
48
48
|
int start_inter_ping_delay = inter_ping_delay_;
|
49
49
|
if (grpc_bdp_estimator_trace.enabled()) {
|
50
|
-
gpr_log(
|
50
|
+
gpr_log(GPR_INFO,
|
51
51
|
"bdp[%s]:complete acc=%" PRId64 " est=%" PRId64
|
52
52
|
" dt=%lf bw=%lfMbs bw_est=%lfMbs",
|
53
53
|
name_, accumulator_, estimate_, dt, bw / 125000.0,
|
@@ -58,7 +58,7 @@ grpc_millis BdpEstimator::CompletePing() {
|
|
58
58
|
estimate_ = GPR_MAX(accumulator_, estimate_ * 2);
|
59
59
|
bw_est_ = bw;
|
60
60
|
if (grpc_bdp_estimator_trace.enabled()) {
|
61
|
-
gpr_log(
|
61
|
+
gpr_log(GPR_INFO, "bdp[%s]: estimate increased to %" PRId64, name_,
|
62
62
|
estimate_);
|
63
63
|
}
|
64
64
|
inter_ping_delay_ /= 2; // if the ping estimate changes,
|
@@ -75,7 +75,7 @@ grpc_millis BdpEstimator::CompletePing() {
|
|
75
75
|
if (start_inter_ping_delay != inter_ping_delay_) {
|
76
76
|
stable_estimate_count_ = 0;
|
77
77
|
if (grpc_bdp_estimator_trace.enabled()) {
|
78
|
-
gpr_log(
|
78
|
+
gpr_log(GPR_INFO, "bdp[%s]:update_inter_time to %dms", name_,
|
79
79
|
inter_ping_delay_);
|
80
80
|
}
|
81
81
|
}
|