grpc 1.18.0 → 1.19.0.pre1
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 +36 -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.cc +30 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +29 -1
- 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_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_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 +46 -39
- 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
@@ -25,7 +25,9 @@
|
|
25
25
|
#include "src/core/lib/gprpp/thd.h"
|
26
26
|
#include "src/core/lib/iomgr/closure.h"
|
27
27
|
|
28
|
-
|
28
|
+
namespace grpc_core {
|
29
|
+
|
30
|
+
struct ThreadState {
|
29
31
|
gpr_mu mu;
|
30
32
|
size_t id; // For debugging purposes
|
31
33
|
const char* name; // Thread state name
|
@@ -35,17 +37,24 @@ typedef struct {
|
|
35
37
|
bool shutdown;
|
36
38
|
bool queued_long_job;
|
37
39
|
grpc_core::Thread thd;
|
38
|
-
}
|
40
|
+
};
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
enum class ExecutorType {
|
43
|
+
DEFAULT = 0,
|
44
|
+
RESOLVER,
|
45
|
+
|
46
|
+
NUM_EXECUTORS // Add new values above this
|
47
|
+
};
|
45
48
|
|
46
|
-
class
|
49
|
+
enum class ExecutorJobType {
|
50
|
+
SHORT = 0,
|
51
|
+
LONG,
|
52
|
+
NUM_JOB_TYPES // Add new values above this
|
53
|
+
};
|
54
|
+
|
55
|
+
class Executor {
|
47
56
|
public:
|
48
|
-
|
57
|
+
Executor(const char* executor_name);
|
49
58
|
|
50
59
|
void Init();
|
51
60
|
|
@@ -62,55 +71,51 @@ class GrpcExecutor {
|
|
62
71
|
* a short job (i.e expected to not block and complete quickly) */
|
63
72
|
void Enqueue(grpc_closure* closure, grpc_error* error, bool is_short);
|
64
73
|
|
65
|
-
|
66
|
-
|
67
|
-
|
74
|
+
// TODO(sreek): Currently we have two executors (available globally): The
|
75
|
+
// default executor and the resolver executor.
|
76
|
+
//
|
77
|
+
// Some of the functions below operate on the DEFAULT executor only while some
|
78
|
+
// operate of ALL the executors. This is a bit confusing and should be cleaned
|
79
|
+
// up in future (where we make all the following functions take ExecutorType
|
80
|
+
// and/or JobType)
|
68
81
|
|
69
|
-
|
70
|
-
|
71
|
-
size_t max_threads_;
|
72
|
-
gpr_atm num_threads_;
|
73
|
-
gpr_spinlock adding_thread_lock_;
|
74
|
-
};
|
75
|
-
|
76
|
-
// == Global executor functions ==
|
82
|
+
// Initialize ALL the executors
|
83
|
+
static void InitAll();
|
77
84
|
|
78
|
-
|
79
|
-
|
80
|
-
GRPC_RESOLVER_EXECUTOR,
|
85
|
+
// Shutdown ALL the executors
|
86
|
+
static void ShutdownAll();
|
81
87
|
|
82
|
-
|
83
|
-
|
88
|
+
// Set the threading mode for ALL the executors
|
89
|
+
static void SetThreadingAll(bool enable);
|
84
90
|
|
85
|
-
//
|
86
|
-
|
87
|
-
//
|
88
|
-
// Some of the functions below operate on the DEFAULT executor only while some
|
89
|
-
// operate of ALL the executors. This is a bit confusing and should be cleaned
|
90
|
-
// up in future (where we make all the following functions take executor_type
|
91
|
-
// and/or job_type)
|
91
|
+
// Set the threading mode for ALL the executors
|
92
|
+
static void SetThreadingDefault(bool enable);
|
92
93
|
|
93
|
-
//
|
94
|
-
|
94
|
+
// Get the DEFAULT executor scheduler for the given job_type
|
95
|
+
static grpc_closure_scheduler* Scheduler(ExecutorJobType job_type);
|
95
96
|
|
96
|
-
//
|
97
|
-
|
97
|
+
// Get the executor scheduler for a given executor_type and a job_type
|
98
|
+
static grpc_closure_scheduler* Scheduler(ExecutorType executor_type,
|
99
|
+
ExecutorJobType job_type);
|
98
100
|
|
99
|
-
//
|
100
|
-
|
101
|
+
// Return if a given executor is running in threaded mode (i.e if
|
102
|
+
// SetThreading(true) was called previously on that executor)
|
103
|
+
static bool IsThreaded(ExecutorType executor_type);
|
101
104
|
|
102
|
-
//
|
103
|
-
|
105
|
+
// Return if the DEFAULT executor is threaded
|
106
|
+
static bool IsThreadedDefault();
|
104
107
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
+
private:
|
109
|
+
static size_t RunClosures(const char* executor_name, grpc_closure_list list);
|
110
|
+
static void ThreadMain(void* arg);
|
108
111
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
+
const char* name_;
|
113
|
+
ThreadState* thd_state_;
|
114
|
+
size_t max_threads_;
|
115
|
+
gpr_atm num_threads_;
|
116
|
+
gpr_spinlock adding_thread_lock_;
|
117
|
+
};
|
112
118
|
|
113
|
-
//
|
114
|
-
bool grpc_executor_is_threaded();
|
119
|
+
} // namespace grpc_core
|
115
120
|
|
116
121
|
#endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */
|
@@ -47,11 +47,13 @@ bool registered_handlers = false;
|
|
47
47
|
} // namespace
|
48
48
|
|
49
49
|
void grpc_prefork() {
|
50
|
-
grpc_core::ExecCtx exec_ctx;
|
51
50
|
skipped_handler = true;
|
51
|
+
// This may be called after core shuts down, so verify initialized before
|
52
|
+
// instantiating an ExecCtx.
|
52
53
|
if (!grpc_is_initialized()) {
|
53
54
|
return;
|
54
55
|
}
|
56
|
+
grpc_core::ExecCtx exec_ctx;
|
55
57
|
if (!grpc_core::Fork::Enabled()) {
|
56
58
|
gpr_log(GPR_ERROR,
|
57
59
|
"Fork support not enabled; try running with the "
|
@@ -71,7 +73,7 @@ void grpc_prefork() {
|
|
71
73
|
return;
|
72
74
|
}
|
73
75
|
grpc_timer_manager_set_threading(false);
|
74
|
-
|
76
|
+
grpc_core::Executor::SetThreadingAll(false);
|
75
77
|
grpc_core::ExecCtx::Get()->Flush();
|
76
78
|
grpc_core::Fork::AwaitThreads();
|
77
79
|
skipped_handler = false;
|
@@ -82,7 +84,7 @@ void grpc_postfork_parent() {
|
|
82
84
|
grpc_core::Fork::AllowExecCtx();
|
83
85
|
grpc_core::ExecCtx exec_ctx;
|
84
86
|
grpc_timer_manager_set_threading(true);
|
85
|
-
|
87
|
+
grpc_core::Executor::SetThreadingAll(true);
|
86
88
|
}
|
87
89
|
}
|
88
90
|
|
@@ -96,7 +98,7 @@ void grpc_postfork_child() {
|
|
96
98
|
reset_polling_engine();
|
97
99
|
}
|
98
100
|
grpc_timer_manager_set_threading(true);
|
99
|
-
|
101
|
+
grpc_core::Executor::SetThreadingAll(true);
|
100
102
|
}
|
101
103
|
}
|
102
104
|
|
@@ -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);
|