Do not add the TCP buffer length.

pull/17331/head
Yash Tibrewal 6 years ago
parent e57f8aebcb
commit fe4ef31ac2
  1. 3
      src/core/lib/iomgr/buffer_list.cc
  2. 2
      src/core/lib/iomgr/buffer_list.h
  3. 2
      src/core/lib/iomgr/tcp_posix.cc
  4. 5
      test/core/iomgr/buffer_list_test.cc

@ -30,10 +30,9 @@
namespace grpc_core { namespace grpc_core {
void TracedBuffer::AddNewEntry(TracedBuffer** head, uint32_t seq_no, void TracedBuffer::AddNewEntry(TracedBuffer** head, uint32_t seq_no,
uint32_t length, void* arg) { void* arg) {
GPR_DEBUG_ASSERT(head != nullptr); GPR_DEBUG_ASSERT(head != nullptr);
TracedBuffer* new_elem = New<TracedBuffer>(seq_no, arg); TracedBuffer* new_elem = New<TracedBuffer>(seq_no, arg);
new_elem->ts_.length = length;
/* Store the current time as the sendmsg time. */ /* Store the current time as the sendmsg time. */
new_elem->ts_.sendmsg_time = gpr_now(GPR_CLOCK_REALTIME); new_elem->ts_.sendmsg_time = gpr_now(GPR_CLOCK_REALTIME);
if (*head == nullptr) { if (*head == nullptr) {

@ -58,7 +58,7 @@ class TracedBuffer {
/** Add a new entry in the TracedBuffer list pointed to by head. Also saves /** Add a new entry in the TracedBuffer list pointed to by head. Also saves
* sendmsg_time with the current timestamp. */ * sendmsg_time with the current timestamp. */
static void AddNewEntry(grpc_core::TracedBuffer** head, uint32_t seq_no, static void AddNewEntry(grpc_core::TracedBuffer** head, uint32_t seq_no,
uint32_t length, void* arg); void* arg);
/** Processes a received timestamp based on sock_extended_err and /** Processes a received timestamp based on sock_extended_err and
* scm_timestamping structures. It will invoke the timestamps callback if the * scm_timestamping structures. It will invoke the timestamps callback if the

@ -635,7 +635,7 @@ static bool tcp_write_with_timestamps(grpc_tcp* tcp, struct msghdr* msg,
gpr_mu_lock(&tcp->tb_mu); gpr_mu_lock(&tcp->tb_mu);
grpc_core::TracedBuffer::AddNewEntry( grpc_core::TracedBuffer::AddNewEntry(
&tcp->tb_head, static_cast<uint32_t>(tcp->bytes_counter + length), &tcp->tb_head, static_cast<uint32_t>(tcp->bytes_counter + length),
static_cast<uint32_t>(length), tcp->outgoing_buffer_arg); tcp->outgoing_buffer_arg);
gpr_mu_unlock(&tcp->tb_mu); gpr_mu_unlock(&tcp->tb_mu);
tcp->outgoing_buffer_arg = nullptr; tcp->outgoing_buffer_arg = nullptr;
} }

@ -48,7 +48,7 @@ static void TestShutdownFlushesList() {
for (auto i = 0; i < NUM_ELEM; i++) { for (auto i = 0; i < NUM_ELEM; i++) {
gpr_atm_rel_store(&verifier_called[i], static_cast<gpr_atm>(0)); gpr_atm_rel_store(&verifier_called[i], static_cast<gpr_atm>(0));
grpc_core::TracedBuffer::AddNewEntry( grpc_core::TracedBuffer::AddNewEntry(
&list, i, 0, static_cast<void*>(&verifier_called[i])); &list, i, static_cast<void*>(&verifier_called[i]));
} }
grpc_core::TracedBuffer::Shutdown(&list, nullptr, GRPC_ERROR_NONE); grpc_core::TracedBuffer::Shutdown(&list, nullptr, GRPC_ERROR_NONE);
GPR_ASSERT(list == nullptr); GPR_ASSERT(list == nullptr);
@ -66,7 +66,6 @@ static void TestVerifierCalledOnAckVerifier(void* arg,
GPR_ASSERT(ts->acked_time.clock_type == GPR_CLOCK_REALTIME); GPR_ASSERT(ts->acked_time.clock_type == GPR_CLOCK_REALTIME);
GPR_ASSERT(ts->acked_time.tv_sec == 123); GPR_ASSERT(ts->acked_time.tv_sec == 123);
GPR_ASSERT(ts->acked_time.tv_nsec == 456); GPR_ASSERT(ts->acked_time.tv_nsec == 456);
GPR_ASSERT(ts->length == 789);
gpr_atm* done = reinterpret_cast<gpr_atm*>(arg); gpr_atm* done = reinterpret_cast<gpr_atm*>(arg);
gpr_atm_rel_store(done, static_cast<gpr_atm>(1)); gpr_atm_rel_store(done, static_cast<gpr_atm>(1));
} }
@ -85,7 +84,7 @@ static void TestVerifierCalledOnAck() {
grpc_core::TracedBuffer* list = nullptr; grpc_core::TracedBuffer* list = nullptr;
gpr_atm verifier_called; gpr_atm verifier_called;
gpr_atm_rel_store(&verifier_called, static_cast<gpr_atm>(0)); gpr_atm_rel_store(&verifier_called, static_cast<gpr_atm>(0));
grpc_core::TracedBuffer::AddNewEntry(&list, 213, 789, &verifier_called); grpc_core::TracedBuffer::AddNewEntry(&list, 213, &verifier_called);
grpc_core::TracedBuffer::ProcessTimestamp(&list, &serr, &tss); grpc_core::TracedBuffer::ProcessTimestamp(&list, &serr, &tss);
GPR_ASSERT(gpr_atm_acq_load(&verifier_called) == static_cast<gpr_atm>(1)); GPR_ASSERT(gpr_atm_acq_load(&verifier_called) == static_cast<gpr_atm>(1));
GPR_ASSERT(list == nullptr); GPR_ASSERT(list == nullptr);

Loading…
Cancel
Save