aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-11-29 17:36:00 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2018-11-29 18:35:24 -0800
commit95f71d8d7fb25c4ca948b0ac58f00c565c95e27e (patch)
treeebf846617daaa5b15a26969119d264bbccd40d1e /src/core/lib/iomgr
parentde0249ecaf362ed04f1351c57a7c7be9be79bdf8 (diff)
Cache result of failing to set timestamping options
Diffstat (limited to 'src/core/lib/iomgr')
-rw-r--r--src/core/lib/iomgr/tcp_posix.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc
index 6f66551a7e..90827033bd 100644
--- a/src/core/lib/iomgr/tcp_posix.cc
+++ b/src/core/lib/iomgr/tcp_posix.cc
@@ -126,6 +126,7 @@ struct grpc_tcp {
int bytes_counter;
bool socket_ts_enabled; /* True if timestamping options are set on the socket
*/
+ bool ts_capable; /* Cache whether we can set timestamping options */
gpr_atm
stop_error_notification; /* Set to 1 if we do not want to be notified on
errors anymore */
@@ -851,9 +852,11 @@ static bool tcp_flush(grpc_tcp* tcp, grpc_error** error) {
msg.msg_flags = 0;
bool tried_sending_message = false;
if (tcp->outgoing_buffer_arg != nullptr) {
- if (!tcp_write_with_timestamps(tcp, &msg, sending_length, &sent_length)) {
+ if (!tcp->ts_capable ||
+ !tcp_write_with_timestamps(tcp, &msg, sending_length, &sent_length)) {
/* We could not set socket options to collect Fathom timestamps.
* Fallback on writing without timestamps. */
+ tcp->ts_capable = false;
tcp_shutdown_buffer_list(tcp);
} else {
tried_sending_message = true;
@@ -1115,6 +1118,7 @@ grpc_endpoint* grpc_tcp_create(grpc_fd* em_fd,
tcp->is_first_read = true;
tcp->bytes_counter = -1;
tcp->socket_ts_enabled = false;
+ tcp->ts_capable = true;
tcp->outgoing_buffer_arg = nullptr;
/* paired with unref in grpc_tcp_destroy */
gpr_ref_init(&tcp->refcount, 1);