From 052beefdec5d84ddd329e702ccb06fc0139a17b2 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 16 Aug 2018 11:08:00 -0700 Subject: [PATCH] Add further comments --- src/core/lib/iomgr/tcp_posix.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 6d4c0962176..8a479d2cccb 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -120,7 +120,7 @@ struct grpc_tcp { * requirement from the TCP endpoint layer is that this arg should be non-null * if the user wants timestamps for the write. */ void* outgoing_buffer_arg; - /* Current TCP relative sequence number as defined in RFC 793. Used for + /* Current TCP (relative) sequence number which starts out at zero. Used for * timestamping traced buffers. */ int bytes_counter; bool socket_ts_enabled; /* True if timestamping options are set on the socket @@ -576,6 +576,7 @@ static bool tcp_write_with_timestamps(grpc_tcp* tcp, struct msghdr* msg, } tcp->socket_ts_enabled = true; } + /* Set control message to indicate that you want timestamps. */ union { char cmsg_buf[CMSG_SPACE(sizeof(uint32_t))]; struct cmsghdr align; @@ -594,6 +595,7 @@ static bool tcp_write_with_timestamps(grpc_tcp* tcp, struct msghdr* msg, GRPC_STATS_INC_SYSCALL_WRITE(); length = sendmsg(tcp->fd, msg, SENDMSG_FLAGS); } while (length < 0 && errno == EINTR); + /* If there was an error on sendmsg the logic in tcp_flush will handle it. */ *sent_length = length; /* Only save timestamps if all the bytes were taken by sendmsg. */ if (sending_length == static_cast(length)) {