grpc 1.18.0 → 1.19.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 +301 -33
- data/include/grpc/grpc_security.h +195 -0
- data/include/grpc/impl/codegen/grpc_types.h +17 -1
- data/include/grpc/impl/codegen/port_platform.h +40 -0
- data/include/grpc/impl/codegen/slice.h +1 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +2 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +74 -69
- data/src/core/ext/filters/client_channel/client_channel.h +2 -2
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +5 -6
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +5 -4
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +2 -2
- data/src/core/ext/filters/client_channel/client_channel_factory.h +4 -4
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -3
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +176 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +68 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +10 -8
- data/src/core/ext/filters/client_channel/health/health_check_client.h +1 -1
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +146 -156
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +28 -30
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +5 -8
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +5 -8
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +23 -24
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +80 -15
- data/src/core/ext/filters/client_channel/lb_policy.cc +30 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +29 -1
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +6 -1
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +96 -0
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +56 -0
- data/src/core/ext/filters/client_channel/parse_address.cc +24 -5
- data/src/core/ext/filters/client_channel/request_routing.cc +13 -3
- data/src/core/ext/filters/client_channel/request_routing.h +5 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +11 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +9 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +7 -35
- data/src/core/ext/filters/client_channel/subchannel.cc +698 -791
- data/src/core/ext/filters/client_channel/subchannel.h +213 -123
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +97 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +94 -0
- data/src/core/ext/filters/http/client_authority_filter.cc +5 -2
- data/src/core/ext/filters/max_age/max_age_filter.cc +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +13 -12
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +5 -7
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +19 -27
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +18 -19
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +27 -6
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/writing.cc +8 -5
- data/src/core/lib/channel/handshaker.cc +141 -214
- data/src/core/lib/channel/handshaker.h +110 -101
- data/src/core/lib/channel/handshaker_factory.h +11 -19
- data/src/core/lib/channel/handshaker_registry.cc +64 -52
- data/src/core/lib/channel/handshaker_registry.h +21 -16
- data/src/core/lib/gpr/log_posix.cc +2 -1
- data/src/core/lib/gpr/time.cc +8 -0
- data/src/core/lib/gpr/time_posix.cc +8 -2
- data/src/core/lib/gprpp/optional.h +47 -0
- data/src/core/lib/http/httpcli_security_connector.cc +13 -14
- data/src/core/lib/iomgr/buffer_list.cc +182 -24
- data/src/core/lib/iomgr/buffer_list.h +70 -8
- data/src/core/lib/iomgr/combiner.cc +11 -3
- data/src/core/lib/iomgr/error.cc +9 -5
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -0
- data/src/core/lib/iomgr/ev_epollex_linux.cc +136 -162
- data/src/core/lib/iomgr/ev_poll_posix.cc +3 -0
- data/src/core/lib/iomgr/ev_posix.cc +4 -0
- data/src/core/lib/iomgr/ev_posix.h +4 -0
- data/src/core/lib/iomgr/exec_ctx.cc +1 -0
- data/src/core/lib/iomgr/exec_ctx.h +137 -8
- data/src/core/lib/iomgr/executor.cc +122 -87
- data/src/core/lib/iomgr/executor.h +53 -48
- data/src/core/lib/iomgr/fork_posix.cc +6 -4
- data/src/core/lib/iomgr/{network_status_tracker.cc → grpc_if_nametoindex.h} +8 -14
- data/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +42 -0
- data/src/core/lib/iomgr/{network_status_tracker.h → grpc_if_nametoindex_unsupported.cc} +15 -9
- data/src/core/lib/iomgr/internal_errqueue.h +105 -3
- data/src/core/lib/iomgr/iomgr.cc +6 -5
- data/src/core/lib/iomgr/iomgr.h +8 -0
- data/src/core/lib/iomgr/iomgr_custom.cc +6 -2
- data/src/core/lib/iomgr/iomgr_internal.cc +4 -0
- data/src/core/lib/iomgr/iomgr_internal.h +4 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +10 -1
- data/src/core/lib/iomgr/iomgr_windows.cc +8 -1
- data/src/core/lib/iomgr/port.h +1 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +4 -3
- data/src/core/lib/iomgr/resolve_address_windows.cc +2 -1
- data/src/core/lib/iomgr/tcp_custom.cc +0 -4
- data/src/core/lib/iomgr/tcp_posix.cc +58 -44
- data/src/core/lib/iomgr/tcp_uv.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.cc +0 -4
- data/src/core/lib/iomgr/timer_manager.cc +8 -0
- data/src/core/lib/iomgr/udp_server.cc +6 -4
- data/src/core/lib/json/json.cc +1 -4
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +1 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +2 -2
- data/src/core/lib/security/credentials/composite/composite_credentials.h +4 -0
- data/src/core/lib/security/credentials/credentials.h +9 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +15 -2
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +2 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +1 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +2 -2
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +1 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +192 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +213 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +10 -8
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +6 -10
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +10 -8
- data/src/core/lib/security/security_connector/security_connector.h +2 -2
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +4 -6
- data/src/core/lib/security/security_connector/ssl_utils.h +33 -0
- data/src/core/lib/security/transport/security_handshaker.cc +267 -300
- data/src/core/lib/security/transport/security_handshaker.h +11 -2
- data/src/core/lib/security/transport/server_auth_filter.cc +1 -0
- data/src/core/lib/surface/call.cc +5 -1
- data/src/core/lib/surface/channel_init.h +5 -0
- data/src/core/lib/surface/completion_queue.cc +4 -7
- data/src/core/lib/surface/init.cc +5 -3
- data/src/core/lib/surface/init_secure.cc +1 -1
- data/src/core/lib/surface/server.cc +19 -17
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/service_config.h +1 -0
- data/src/core/lib/transport/static_metadata.cc +279 -279
- data/src/core/lib/transport/transport.cc +5 -3
- data/src/core/tsi/ssl_transport_security.cc +10 -4
- data/src/ruby/ext/grpc/extconf.rb +12 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +8 -5
- data/src/ruby/ext/grpc/rb_channel.c +14 -10
- data/src/ruby/ext/grpc/rb_channel_credentials.c +8 -4
- data/src/ruby/ext/grpc/rb_compression_options.c +9 -7
- data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc.c +22 -23
- data/src/ruby/ext/grpc/rb_grpc.h +4 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +18 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +27 -0
- data/src/ruby/ext/grpc/rb_server.c +8 -4
- data/src/ruby/lib/grpc/version.rb +1 -1
- metadata +45 -38
- data/src/core/ext/filters/client_channel/subchannel_index.cc +0 -248
- data/src/core/ext/filters/client_channel/subchannel_index.h +0 -76
- data/src/core/lib/channel/handshaker_factory.cc +0 -42
@@ -16,21 +16,15 @@
|
|
16
16
|
*
|
17
17
|
*/
|
18
18
|
|
19
|
-
#
|
20
|
-
|
21
|
-
#include "src/core/lib/iomgr/endpoint.h"
|
22
|
-
#include "src/core/lib/iomgr/network_status_tracker.h"
|
23
|
-
|
24
|
-
void grpc_network_status_shutdown(void) {}
|
19
|
+
#ifndef GRPC_CORE_LIB_IOMGR_GRPC_IF_NAMETOINDEX_H
|
20
|
+
#define GRPC_CORE_LIB_IOMGR_GRPC_IF_NAMETOINDEX_H
|
25
21
|
|
26
|
-
|
27
|
-
// TODO(makarandd): Install callback with OS to monitor network status.
|
28
|
-
}
|
29
|
-
|
30
|
-
void grpc_destroy_network_status_monitor() {}
|
22
|
+
#include <grpc/support/port_platform.h>
|
31
23
|
|
32
|
-
|
24
|
+
#include <stddef.h>
|
33
25
|
|
34
|
-
|
26
|
+
/* Returns the interface index corresponding to the interface "name" provided.
|
27
|
+
* Returns non-zero upon success, and zero upon failure. */
|
28
|
+
uint32_t grpc_if_nametoindex(char* name);
|
35
29
|
|
36
|
-
|
30
|
+
#endif /* GRPC_CORE_LIB_IOMGR_GRPC_IF_NAMETOINDEX_H */
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2016 gRPC authors.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include <grpc/support/port_platform.h>
|
20
|
+
|
21
|
+
#include "src/core/lib/iomgr/port.h"
|
22
|
+
|
23
|
+
#if GRPC_IF_NAMETOINDEX == 1 && defined(GRPC_POSIX_SOCKET_IF_NAMETOINDEX)
|
24
|
+
|
25
|
+
#include "src/core/lib/iomgr/grpc_if_nametoindex.h"
|
26
|
+
|
27
|
+
#include <errno.h>
|
28
|
+
#include <net/if.h>
|
29
|
+
|
30
|
+
#include <grpc/support/log.h>
|
31
|
+
|
32
|
+
uint32_t grpc_if_nametoindex(char* name) {
|
33
|
+
uint32_t out = if_nametoindex(name);
|
34
|
+
if (out == 0) {
|
35
|
+
gpr_log(GPR_DEBUG, "if_nametoindex failed for name %s. errno %d", name,
|
36
|
+
errno);
|
37
|
+
}
|
38
|
+
return out;
|
39
|
+
}
|
40
|
+
|
41
|
+
#endif /* GRPC_IF_NAMETOINDEX == 1 && \
|
42
|
+
defined(GRPC_POSIX_SOCKET_IF_NAMETOINDEX) */
|
@@ -16,17 +16,23 @@
|
|
16
16
|
*
|
17
17
|
*/
|
18
18
|
|
19
|
-
#ifndef GRPC_CORE_LIB_IOMGR_NETWORK_STATUS_TRACKER_H
|
20
|
-
#define GRPC_CORE_LIB_IOMGR_NETWORK_STATUS_TRACKER_H
|
21
19
|
#include <grpc/support/port_platform.h>
|
22
20
|
|
23
|
-
#include "src/core/lib/iomgr/
|
21
|
+
#include "src/core/lib/iomgr/port.h"
|
24
22
|
|
25
|
-
|
26
|
-
void grpc_network_status_shutdown(void);
|
23
|
+
#if GRPC_IF_NAMETOINDEX == 0 || !defined(GRPC_POSIX_SOCKET_IF_NAMETOINDEX)
|
27
24
|
|
28
|
-
|
29
|
-
void grpc_network_status_unregister_endpoint(grpc_endpoint* ep);
|
30
|
-
void grpc_network_status_shutdown_all_endpoints();
|
25
|
+
#include "src/core/lib/iomgr/grpc_if_nametoindex.h"
|
31
26
|
|
32
|
-
#
|
27
|
+
#include <grpc/support/log.h>
|
28
|
+
|
29
|
+
uint32_t grpc_if_nametoindex(char* name) {
|
30
|
+
gpr_log(GPR_DEBUG,
|
31
|
+
"Not attempting to convert interface name %s to index for current "
|
32
|
+
"platform.",
|
33
|
+
name);
|
34
|
+
return 0;
|
35
|
+
}
|
36
|
+
|
37
|
+
#endif /* GRPC_IF_NAMETOINDEX == 0 || \
|
38
|
+
!defined(GRPC_POSIX_SOCKET_IF_NAMETOINDEX) */
|
@@ -37,6 +37,7 @@
|
|
37
37
|
#ifdef GRPC_LINUX_ERRQUEUE
|
38
38
|
#include <linux/errqueue.h>
|
39
39
|
#include <linux/net_tstamp.h>
|
40
|
+
#include <linux/netlink.h>
|
40
41
|
#include <sys/socket.h>
|
41
42
|
#endif /* GRPC_LINUX_ERRQUEUE */
|
42
43
|
|
@@ -56,6 +57,12 @@ constexpr int SCM_TSTAMP_SND = 0;
|
|
56
57
|
constexpr int SCM_TSTAMP_SCHED = 1;
|
57
58
|
/* The timestamp type for when data acknowledged by peer. */
|
58
59
|
constexpr int SCM_TSTAMP_ACK = 2;
|
60
|
+
|
61
|
+
/* Control message type containing OPT_STATS */
|
62
|
+
#ifndef SCM_TIMESTAMPING_OPT_STATS
|
63
|
+
#define SCM_TIMESTAMPING_OPT_STATS 54
|
64
|
+
#endif
|
65
|
+
|
59
66
|
/* Redefine required constants from <linux/net_tstamp.h> */
|
60
67
|
constexpr uint32_t SOF_TIMESTAMPING_TX_SOFTWARE = 1u << 1;
|
61
68
|
constexpr uint32_t SOF_TIMESTAMPING_SOFTWARE = 1u << 4;
|
@@ -63,13 +70,108 @@ constexpr uint32_t SOF_TIMESTAMPING_OPT_ID = 1u << 7;
|
|
63
70
|
constexpr uint32_t SOF_TIMESTAMPING_TX_SCHED = 1u << 8;
|
64
71
|
constexpr uint32_t SOF_TIMESTAMPING_TX_ACK = 1u << 9;
|
65
72
|
constexpr uint32_t SOF_TIMESTAMPING_OPT_TSONLY = 1u << 11;
|
73
|
+
constexpr uint32_t SOF_TIMESTAMPING_OPT_STATS = 1u << 12;
|
66
74
|
|
67
|
-
constexpr uint32_t kTimestampingSocketOptions =
|
68
|
-
|
69
|
-
|
75
|
+
constexpr uint32_t kTimestampingSocketOptions =
|
76
|
+
SOF_TIMESTAMPING_SOFTWARE | SOF_TIMESTAMPING_OPT_ID |
|
77
|
+
SOF_TIMESTAMPING_OPT_TSONLY | SOF_TIMESTAMPING_OPT_STATS;
|
70
78
|
constexpr uint32_t kTimestampingRecordingOptions =
|
71
79
|
SOF_TIMESTAMPING_TX_SCHED | SOF_TIMESTAMPING_TX_SOFTWARE |
|
72
80
|
SOF_TIMESTAMPING_TX_ACK;
|
81
|
+
|
82
|
+
/* Netlink attribute types used for TCP opt stats. */
|
83
|
+
enum TCPOptStats {
|
84
|
+
TCP_NLA_PAD,
|
85
|
+
TCP_NLA_BUSY, /* Time (usec) busy sending data. */
|
86
|
+
TCP_NLA_RWND_LIMITED, /* Time (usec) limited by receive window. */
|
87
|
+
TCP_NLA_SNDBUF_LIMITED, /* Time (usec) limited by send buffer. */
|
88
|
+
TCP_NLA_DATA_SEGS_OUT, /* Data pkts sent including retransmission. */
|
89
|
+
TCP_NLA_TOTAL_RETRANS, /* Data pkts retransmitted. */
|
90
|
+
TCP_NLA_PACING_RATE, /* Pacing rate in Bps. */
|
91
|
+
TCP_NLA_DELIVERY_RATE, /* Delivery rate in Bps. */
|
92
|
+
TCP_NLA_SND_CWND, /* Sending congestion window. */
|
93
|
+
TCP_NLA_REORDERING, /* Reordering metric. */
|
94
|
+
TCP_NLA_MIN_RTT, /* minimum RTT. */
|
95
|
+
TCP_NLA_RECUR_RETRANS, /* Recurring retransmits for the current pkt. */
|
96
|
+
TCP_NLA_DELIVERY_RATE_APP_LMT, /* Delivery rate application limited? */
|
97
|
+
TCP_NLA_SNDQ_SIZE, /* Data (bytes) pending in send queue */
|
98
|
+
TCP_NLA_CA_STATE, /* ca_state of socket */
|
99
|
+
TCP_NLA_SND_SSTHRESH, /* Slow start size threshold */
|
100
|
+
TCP_NLA_DELIVERED, /* Data pkts delivered incl. out-of-order */
|
101
|
+
TCP_NLA_DELIVERED_CE, /* Like above but only ones w/ CE marks */
|
102
|
+
TCP_NLA_BYTES_SENT, /* Data bytes sent including retransmission */
|
103
|
+
TCP_NLA_BYTES_RETRANS, /* Data bytes retransmitted */
|
104
|
+
TCP_NLA_DSACK_DUPS, /* DSACK blocks received */
|
105
|
+
TCP_NLA_REORD_SEEN, /* reordering events seen */
|
106
|
+
TCP_NLA_SRTT, /* smoothed RTT in usecs */
|
107
|
+
};
|
108
|
+
|
109
|
+
/* tcp_info from from linux/tcp.h */
|
110
|
+
struct tcp_info {
|
111
|
+
uint8_t tcpi_state;
|
112
|
+
uint8_t tcpi_ca_state;
|
113
|
+
uint8_t tcpi_retransmits;
|
114
|
+
uint8_t tcpi_probes;
|
115
|
+
uint8_t tcpi_backoff;
|
116
|
+
uint8_t tcpi_options;
|
117
|
+
uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
|
118
|
+
uint8_t tcpi_delivery_rate_app_limited : 1;
|
119
|
+
uint32_t tcpi_rto;
|
120
|
+
uint32_t tcpi_ato;
|
121
|
+
uint32_t tcpi_snd_mss;
|
122
|
+
uint32_t tcpi_rcv_mss;
|
123
|
+
uint32_t tcpi_unacked;
|
124
|
+
uint32_t tcpi_sacked;
|
125
|
+
uint32_t tcpi_lost;
|
126
|
+
uint32_t tcpi_retrans;
|
127
|
+
uint32_t tcpi_fackets;
|
128
|
+
/* Times. */
|
129
|
+
uint32_t tcpi_last_data_sent;
|
130
|
+
uint32_t tcpi_last_ack_sent; /* Not remembered, sorry. */
|
131
|
+
uint32_t tcpi_last_data_recv;
|
132
|
+
uint32_t tcpi_last_ack_recv;
|
133
|
+
/* Metrics. */
|
134
|
+
uint32_t tcpi_pmtu;
|
135
|
+
uint32_t tcpi_rcv_ssthresh;
|
136
|
+
uint32_t tcpi_rtt;
|
137
|
+
uint32_t tcpi_rttvar;
|
138
|
+
uint32_t tcpi_snd_ssthresh;
|
139
|
+
uint32_t tcpi_snd_cwnd;
|
140
|
+
uint32_t tcpi_advmss;
|
141
|
+
uint32_t tcpi_reordering;
|
142
|
+
uint32_t tcpi_rcv_rtt;
|
143
|
+
uint32_t tcpi_rcv_space;
|
144
|
+
uint32_t tcpi_total_retrans;
|
145
|
+
uint64_t tcpi_pacing_rate;
|
146
|
+
uint64_t tcpi_max_pacing_rate;
|
147
|
+
uint64_t tcpi_bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked */
|
148
|
+
uint64_t tcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */
|
149
|
+
|
150
|
+
uint32_t tcpi_segs_out; /* RFC4898 tcpEStatsPerfSegsOut */
|
151
|
+
uint32_t tcpi_segs_in; /* RFC4898 tcpEStatsPerfSegsIn */
|
152
|
+
uint32_t tcpi_notsent_bytes;
|
153
|
+
uint32_t tcpi_min_rtt;
|
154
|
+
|
155
|
+
uint32_t tcpi_data_segs_in; /* RFC4898 tcpEStatsDataSegsIn */
|
156
|
+
uint32_t tcpi_data_segs_out; /* RFC4898 tcpEStatsDataSegsOut */
|
157
|
+
|
158
|
+
uint64_t tcpi_delivery_rate;
|
159
|
+
uint64_t tcpi_busy_time; /* Time (usec) busy sending data */
|
160
|
+
uint64_t tcpi_rwnd_limited; /* Time (usec) limited by receive window */
|
161
|
+
uint64_t tcpi_sndbuf_limited; /* Time (usec) limited by send buffer */
|
162
|
+
|
163
|
+
uint32_t tcpi_delivered;
|
164
|
+
uint32_t tcpi_delivered_ce;
|
165
|
+
uint64_t tcpi_bytes_sent; /* RFC4898 tcpEStatsPerfHCDataOctetsOut */
|
166
|
+
uint64_t tcpi_bytes_retrans; /* RFC4898 tcpEStatsPerfOctetsRetrans */
|
167
|
+
uint32_t tcpi_dsack_dups; /* RFC4898 tcpEStatsStackDSACKDups */
|
168
|
+
uint32_t tcpi_reord_seen; /* reordering events seen */
|
169
|
+
socklen_t length; /* Length of struct returned by kernel */
|
170
|
+
};
|
171
|
+
|
172
|
+
#ifndef TCP_INFO
|
173
|
+
#define TCP_INFO 11
|
174
|
+
#endif
|
73
175
|
#endif /* GRPC_LINUX_ERRQUEUE */
|
74
176
|
|
75
177
|
/* Returns true if kernel is capable of supporting errqueue and timestamping.
|
data/src/core/lib/iomgr/iomgr.cc
CHANGED
@@ -38,7 +38,6 @@
|
|
38
38
|
#include "src/core/lib/iomgr/executor.h"
|
39
39
|
#include "src/core/lib/iomgr/internal_errqueue.h"
|
40
40
|
#include "src/core/lib/iomgr/iomgr_internal.h"
|
41
|
-
#include "src/core/lib/iomgr/network_status_tracker.h"
|
42
41
|
#include "src/core/lib/iomgr/timer.h"
|
43
42
|
#include "src/core/lib/iomgr/timer_manager.h"
|
44
43
|
|
@@ -53,11 +52,10 @@ void grpc_iomgr_init() {
|
|
53
52
|
g_shutdown = 0;
|
54
53
|
gpr_mu_init(&g_mu);
|
55
54
|
gpr_cv_init(&g_rcv);
|
56
|
-
|
55
|
+
grpc_core::Executor::InitAll();
|
57
56
|
grpc_timer_list_init();
|
58
57
|
g_root_object.next = g_root_object.prev = &g_root_object;
|
59
58
|
g_root_object.name = (char*)"root";
|
60
|
-
grpc_network_status_init();
|
61
59
|
grpc_iomgr_platform_init();
|
62
60
|
grpc_core::grpc_errqueue_init();
|
63
61
|
}
|
@@ -90,7 +88,7 @@ void grpc_iomgr_shutdown() {
|
|
90
88
|
{
|
91
89
|
grpc_timer_manager_shutdown();
|
92
90
|
grpc_iomgr_platform_flush();
|
93
|
-
|
91
|
+
grpc_core::Executor::ShutdownAll();
|
94
92
|
|
95
93
|
gpr_mu_lock(&g_mu);
|
96
94
|
g_shutdown = 1;
|
@@ -152,7 +150,6 @@ void grpc_iomgr_shutdown() {
|
|
152
150
|
gpr_mu_unlock(&g_mu);
|
153
151
|
|
154
152
|
grpc_iomgr_platform_shutdown();
|
155
|
-
grpc_network_status_shutdown();
|
156
153
|
gpr_mu_destroy(&g_mu);
|
157
154
|
gpr_cv_destroy(&g_rcv);
|
158
155
|
}
|
@@ -161,6 +158,10 @@ void grpc_iomgr_shutdown_background_closure() {
|
|
161
158
|
grpc_iomgr_platform_shutdown_background_closure();
|
162
159
|
}
|
163
160
|
|
161
|
+
bool grpc_iomgr_is_any_background_poller_thread() {
|
162
|
+
return grpc_iomgr_platform_is_any_background_poller_thread();
|
163
|
+
}
|
164
|
+
|
164
165
|
void grpc_iomgr_register_object(grpc_iomgr_object* obj, const char* name) {
|
165
166
|
obj->name = gpr_strdup(name);
|
166
167
|
gpr_mu_lock(&g_mu);
|
data/src/core/lib/iomgr/iomgr.h
CHANGED
@@ -39,6 +39,14 @@ void grpc_iomgr_shutdown();
|
|
39
39
|
* background poller. */
|
40
40
|
void grpc_iomgr_shutdown_background_closure();
|
41
41
|
|
42
|
+
/* Returns true if polling engine runs in the background, false otherwise.
|
43
|
+
* Currently only 'epollbg' runs in the background.
|
44
|
+
*/
|
45
|
+
bool grpc_iomgr_run_in_background();
|
46
|
+
|
47
|
+
/** Returns true if the caller is a worker thread for any background poller. */
|
48
|
+
bool grpc_iomgr_is_any_background_poller_thread();
|
49
|
+
|
42
50
|
/* Exposed only for testing */
|
43
51
|
size_t grpc_iomgr_count_objects_for_testing();
|
44
52
|
|
@@ -34,17 +34,21 @@ gpr_thd_id g_init_thread;
|
|
34
34
|
|
35
35
|
static void iomgr_platform_init(void) {
|
36
36
|
grpc_core::ExecCtx exec_ctx;
|
37
|
-
|
37
|
+
grpc_core::Executor::SetThreadingAll(false);
|
38
38
|
g_init_thread = gpr_thd_currentid();
|
39
39
|
grpc_pollset_global_init();
|
40
40
|
}
|
41
41
|
static void iomgr_platform_flush(void) {}
|
42
42
|
static void iomgr_platform_shutdown(void) { grpc_pollset_global_shutdown(); }
|
43
43
|
static void iomgr_platform_shutdown_background_closure(void) {}
|
44
|
+
static bool iomgr_platform_is_any_background_poller_thread(void) {
|
45
|
+
return false;
|
46
|
+
}
|
44
47
|
|
45
48
|
static grpc_iomgr_platform_vtable vtable = {
|
46
49
|
iomgr_platform_init, iomgr_platform_flush, iomgr_platform_shutdown,
|
47
|
-
iomgr_platform_shutdown_background_closure
|
50
|
+
iomgr_platform_shutdown_background_closure,
|
51
|
+
iomgr_platform_is_any_background_poller_thread};
|
48
52
|
|
49
53
|
void grpc_custom_iomgr_init(grpc_socket_vtable* socket,
|
50
54
|
grpc_custom_resolver_vtable* resolver,
|
@@ -45,3 +45,7 @@ void grpc_iomgr_platform_shutdown() { iomgr_platform_vtable->shutdown(); }
|
|
45
45
|
void grpc_iomgr_platform_shutdown_background_closure() {
|
46
46
|
iomgr_platform_vtable->shutdown_background_closure();
|
47
47
|
}
|
48
|
+
|
49
|
+
bool grpc_iomgr_platform_is_any_background_poller_thread() {
|
50
|
+
return iomgr_platform_vtable->is_any_background_poller_thread();
|
51
|
+
}
|
@@ -36,6 +36,7 @@ typedef struct grpc_iomgr_platform_vtable {
|
|
36
36
|
void (*flush)(void);
|
37
37
|
void (*shutdown)(void);
|
38
38
|
void (*shutdown_background_closure)(void);
|
39
|
+
bool (*is_any_background_poller_thread)(void);
|
39
40
|
} grpc_iomgr_platform_vtable;
|
40
41
|
|
41
42
|
void grpc_iomgr_register_object(grpc_iomgr_object* obj, const char* name);
|
@@ -56,6 +57,9 @@ void grpc_iomgr_platform_shutdown(void);
|
|
56
57
|
/** shut down all the closures registered in the background poller */
|
57
58
|
void grpc_iomgr_platform_shutdown_background_closure(void);
|
58
59
|
|
60
|
+
/** return true is the caller is a worker thread for any background poller */
|
61
|
+
bool grpc_iomgr_platform_is_any_background_poller_thread(void);
|
62
|
+
|
59
63
|
bool grpc_iomgr_abort_on_leaks(void);
|
60
64
|
|
61
65
|
#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H */
|
@@ -55,9 +55,14 @@ static void iomgr_platform_shutdown_background_closure(void) {
|
|
55
55
|
grpc_shutdown_background_closure();
|
56
56
|
}
|
57
57
|
|
58
|
+
static bool iomgr_platform_is_any_background_poller_thread(void) {
|
59
|
+
return grpc_is_any_background_poller_thread();
|
60
|
+
}
|
61
|
+
|
58
62
|
static grpc_iomgr_platform_vtable vtable = {
|
59
63
|
iomgr_platform_init, iomgr_platform_flush, iomgr_platform_shutdown,
|
60
|
-
iomgr_platform_shutdown_background_closure
|
64
|
+
iomgr_platform_shutdown_background_closure,
|
65
|
+
iomgr_platform_is_any_background_poller_thread};
|
61
66
|
|
62
67
|
void grpc_set_default_iomgr_platform() {
|
63
68
|
grpc_set_tcp_client_impl(&grpc_posix_tcp_client_vtable);
|
@@ -69,4 +74,8 @@ void grpc_set_default_iomgr_platform() {
|
|
69
74
|
grpc_set_iomgr_platform_vtable(&vtable);
|
70
75
|
}
|
71
76
|
|
77
|
+
bool grpc_iomgr_run_in_background() {
|
78
|
+
return grpc_event_engine_run_in_background();
|
79
|
+
}
|
80
|
+
|
72
81
|
#endif /* GRPC_POSIX_SOCKET_IOMGR */
|
@@ -73,9 +73,14 @@ static void iomgr_platform_shutdown(void) {
|
|
73
73
|
|
74
74
|
static void iomgr_platform_shutdown_background_closure(void) {}
|
75
75
|
|
76
|
+
static bool iomgr_platform_is_any_background_poller_thread(void) {
|
77
|
+
return false;
|
78
|
+
}
|
79
|
+
|
76
80
|
static grpc_iomgr_platform_vtable vtable = {
|
77
81
|
iomgr_platform_init, iomgr_platform_flush, iomgr_platform_shutdown,
|
78
|
-
iomgr_platform_shutdown_background_closure
|
82
|
+
iomgr_platform_shutdown_background_closure,
|
83
|
+
iomgr_platform_is_any_background_poller_thread};
|
79
84
|
|
80
85
|
void grpc_set_default_iomgr_platform() {
|
81
86
|
grpc_set_tcp_client_impl(&grpc_windows_tcp_client_vtable);
|
@@ -87,4 +92,6 @@ void grpc_set_default_iomgr_platform() {
|
|
87
92
|
grpc_set_iomgr_platform_vtable(&vtable);
|
88
93
|
}
|
89
94
|
|
95
|
+
bool grpc_iomgr_run_in_background() { return false; }
|
96
|
+
|
90
97
|
#endif /* GRPC_WINSOCK_SOCKET */
|
data/src/core/lib/iomgr/port.h
CHANGED
@@ -184,6 +184,7 @@
|
|
184
184
|
#define GRPC_POSIX_SOCKET_EV_EPOLLEX 1
|
185
185
|
#define GRPC_POSIX_SOCKET_EV_POLL 1
|
186
186
|
#define GRPC_POSIX_SOCKET_EV_EPOLL1 1
|
187
|
+
#define GRPC_POSIX_SOCKET_IF_NAMETOINDEX 1
|
187
188
|
#define GRPC_POSIX_SOCKET_IOMGR 1
|
188
189
|
#define GRPC_POSIX_SOCKET_RESOLVE_ADDRESS 1
|
189
190
|
#define GRPC_POSIX_SOCKET_SOCKADDR 1
|
@@ -105,7 +105,7 @@ static grpc_error* posix_blocking_resolve_address(
|
|
105
105
|
grpc_error_set_str(
|
106
106
|
grpc_error_set_str(
|
107
107
|
grpc_error_set_int(
|
108
|
-
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
108
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING(gai_strerror(s)),
|
109
109
|
GRPC_ERROR_INT_ERRNO, s),
|
110
110
|
GRPC_ERROR_STR_OS_ERROR,
|
111
111
|
grpc_slice_from_static_string(gai_strerror(s))),
|
@@ -150,7 +150,7 @@ typedef struct {
|
|
150
150
|
void* arg;
|
151
151
|
} request;
|
152
152
|
|
153
|
-
/* Callback to be passed to
|
153
|
+
/* Callback to be passed to grpc Executor to asynch-ify
|
154
154
|
* grpc_blocking_resolve_address */
|
155
155
|
static void do_request_thread(void* rp, grpc_error* error) {
|
156
156
|
request* r = static_cast<request*>(rp);
|
@@ -168,7 +168,8 @@ static void posix_resolve_address(const char* name, const char* default_port,
|
|
168
168
|
request* r = static_cast<request*>(gpr_malloc(sizeof(request)));
|
169
169
|
GRPC_CLOSURE_INIT(
|
170
170
|
&r->request_closure, do_request_thread, r,
|
171
|
-
|
171
|
+
grpc_core::Executor::Scheduler(grpc_core::ExecutorType::RESOLVER,
|
172
|
+
grpc_core::ExecutorJobType::SHORT));
|
172
173
|
r->name = gpr_strdup(name);
|
173
174
|
r->default_port = gpr_strdup(default_port);
|
174
175
|
r->on_done = on_done;
|
@@ -153,7 +153,8 @@ static void windows_resolve_address(const char* name, const char* default_port,
|
|
153
153
|
request* r = (request*)gpr_malloc(sizeof(request));
|
154
154
|
GRPC_CLOSURE_INIT(
|
155
155
|
&r->request_closure, do_request_thread, r,
|
156
|
-
|
156
|
+
grpc_core::Executor::Scheduler(grpc_core::ExecutorType::RESOLVER,
|
157
|
+
grpc_core::ExecutorJobType::SHORT));
|
157
158
|
r->name = gpr_strdup(name);
|
158
159
|
r->default_port = gpr_strdup(default_port);
|
159
160
|
r->on_done = on_done;
|
@@ -31,7 +31,6 @@
|
|
31
31
|
|
32
32
|
#include "src/core/lib/iomgr/error.h"
|
33
33
|
#include "src/core/lib/iomgr/iomgr_custom.h"
|
34
|
-
#include "src/core/lib/iomgr/network_status_tracker.h"
|
35
34
|
#include "src/core/lib/iomgr/resource_quota.h"
|
36
35
|
#include "src/core/lib/iomgr/tcp_client.h"
|
37
36
|
#include "src/core/lib/iomgr/tcp_custom.h"
|
@@ -309,7 +308,6 @@ static void custom_close_callback(grpc_custom_socket* socket) {
|
|
309
308
|
}
|
310
309
|
|
311
310
|
static void endpoint_destroy(grpc_endpoint* ep) {
|
312
|
-
grpc_network_status_unregister_endpoint(ep);
|
313
311
|
custom_tcp_endpoint* tcp = (custom_tcp_endpoint*)ep;
|
314
312
|
grpc_custom_socket_vtable->close(tcp->socket, custom_close_callback);
|
315
313
|
}
|
@@ -361,8 +359,6 @@ grpc_endpoint* custom_tcp_endpoint_create(grpc_custom_socket* socket,
|
|
361
359
|
tcp->resource_user = grpc_resource_user_create(resource_quota, peer_string);
|
362
360
|
grpc_resource_user_slice_allocator_init(
|
363
361
|
&tcp->slice_allocator, tcp->resource_user, tcp_read_allocation_done, tcp);
|
364
|
-
/* Tell network status tracking code about the new endpoint */
|
365
|
-
grpc_network_status_register_endpoint(&tcp->base);
|
366
362
|
|
367
363
|
return &tcp->base;
|
368
364
|
}
|