aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/transport/chttp2
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-11-16 15:27:13 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2018-11-16 18:11:42 -0800
commitbab043e8650799b91a4e40853e56439c2ddb15a7 (patch)
tree0b312ab9355dcc206e136a929fd6b58035b8d1d4 /src/core/ext/transport/chttp2
parentfc332d2c9247832af90792a59ff6d391e84bc8ae (diff)
Cleanup
Diffstat (limited to 'src/core/ext/transport/chttp2')
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.cc7
-rw-r--r--src/core/ext/transport/chttp2/transport/context_list.cc17
-rw-r--r--src/core/ext/transport/chttp2/transport/context_list.h30
-rw-r--r--src/core/ext/transport/chttp2/transport/internal.h4
-rw-r--r--src/core/ext/transport/chttp2/transport/writing.cc3
5 files changed, 26 insertions, 35 deletions
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
index da29ff1b37..4ca0f49adf 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
@@ -157,7 +157,6 @@ bool g_flow_control_enabled = true;
*/
grpc_chttp2_transport::~grpc_chttp2_transport() {
- gpr_log(GPR_INFO, "destruct transport %p", t);
size_t i;
if (channelz_socket != nullptr) {
@@ -172,11 +171,12 @@ grpc_chttp2_transport::~grpc_chttp2_transport() {
grpc_chttp2_hpack_compressor_destroy(&hpack_compressor);
grpc_core::ContextList::Execute(cl, nullptr, GRPC_ERROR_NONE);
+ cl = nullptr;
+
grpc_slice_buffer_destroy_internal(&read_buffer);
grpc_chttp2_hpack_parser_destroy(&hpack_parser);
grpc_chttp2_goaway_parser_destroy(&goaway_parser);
-
for (i = 0; i < STREAM_LIST_COUNT; i++) {
GPR_ASSERT(lists[i].head == nullptr);
GPR_ASSERT(lists[i].tail == nullptr);
@@ -1072,9 +1072,6 @@ static void write_action(void* gt, grpc_error* error) {
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(gt);
void* cl = t->cl;
t->cl = nullptr;
- if (cl) {
- gpr_log(GPR_INFO, "cleared for write");
- }
grpc_endpoint_write(
t->ep, &t->outbuf,
GRPC_CLOSURE_INIT(&t->write_action_end_locked, write_action_end_locked, t,
diff --git a/src/core/ext/transport/chttp2/transport/context_list.cc b/src/core/ext/transport/chttp2/transport/context_list.cc
index 91c26a5bca..11f5c14a39 100644
--- a/src/core/ext/transport/chttp2/transport/context_list.cc
+++ b/src/core/ext/transport/chttp2/transport/context_list.cc
@@ -21,33 +21,30 @@
#include "src/core/ext/transport/chttp2/transport/context_list.h"
namespace {
-void (*cb)(void*, const char*) = nullptr;
+void (*cb)(void*, grpc_core::Timestamps*) = nullptr;
}
namespace grpc_core {
void ContextList::Execute(void* arg, grpc_core::Timestamps* ts,
grpc_error* error) {
- gpr_log(GPR_INFO, "execute");
ContextList* head = static_cast<ContextList*>(arg);
ContextList* ptr;
while (head != nullptr) {
if (error == GRPC_ERROR_NONE && ts != nullptr) {
if (cb) {
- cb(head->s->context, ts);
+ cb(head->s_->context, ts);
}
}
- gpr_log(GPR_INFO, "one iteration %p %p", head, arg);
- GRPC_CHTTP2_STREAM_UNREF(static_cast<grpc_chttp2_stream *>(head->s),
- "timestamp exec");
- //grpc_stream_unref(head->s->refcount);
+ GRPC_CHTTP2_STREAM_UNREF(static_cast<grpc_chttp2_stream*>(head->s_),
+ "timestamp");
ptr = head;
- head = head->next;
- gpr_free(ptr);
+ head = head->next_;
+ grpc_core::Delete(ptr);
}
}
void grpc_http2_set_write_timestamps_callback(
- void (*fn)(void*, const char*)) {
+ void (*fn)(void*, grpc_core::Timestamps*)) {
cb = fn;
}
} /* namespace grpc_core */
diff --git a/src/core/ext/transport/chttp2/transport/context_list.h b/src/core/ext/transport/chttp2/transport/context_list.h
index 23a49d5b32..0cf7ba4dc3 100644
--- a/src/core/ext/transport/chttp2/transport/context_list.h
+++ b/src/core/ext/transport/chttp2/transport/context_list.h
@@ -35,29 +35,25 @@ class ContextList {
/* Make sure context is not already present */
ContextList* ptr = *head;
GRPC_CHTTP2_STREAM_REF(s, "timestamp");
- //grpc_stream_ref(s->refcount);
while (ptr != nullptr) {
- if (ptr->s == s) {
- GPR_ASSERT(false);
+ if (ptr->s_ == s) {
+ GPR_ASSERT(
+ false &&
+ "Trying to append a stream that is already present in the list");
}
- ptr = ptr->next;
+ ptr = ptr->next_;
}
- ContextList* elem =
- static_cast<ContextList*>(gpr_malloc(sizeof(ContextList)));
- elem->s = s;
- elem->next = nullptr;
+ ContextList* elem = grpc_core::New<ContextList>();
+ elem->s_ = s;
if (*head == nullptr) {
*head = elem;
- gpr_log(GPR_INFO, "new head");
- gpr_log(GPR_INFO, "append %p %p", elem, *head);
return;
}
- gpr_log(GPR_INFO, "append %p %p", elem, *head);
ptr = *head;
- while (ptr->next != nullptr) {
- ptr = ptr->next;
+ while (ptr->next_ != nullptr) {
+ ptr = ptr->next_;
}
- ptr->next = elem;
+ ptr->next_ = elem;
}
/* Executes a function \a fn with each context in the list and \a ts. It also
@@ -65,12 +61,12 @@ class ContextList {
static void Execute(void* arg, grpc_core::Timestamps* ts, grpc_error* error);
private:
- grpc_chttp2_stream* s;
- ContextList* next;
+ grpc_chttp2_stream* s_ = nullptr;
+ ContextList* next_ = nullptr;
};
void grpc_http2_set_write_timestamps_callback(
- void (*fn)(void*, const char*));
+ void (*fn)(void*, grpc_core::Timestamps*));
} /* namespace grpc_core */
#endif /* GRPC_CORE_EXT_TRANSPORT_CONTEXT_LIST_H */
diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h
index 8a83f4894c..877b8aba77 100644
--- a/src/core/ext/transport/chttp2/transport/internal.h
+++ b/src/core/ext/transport/chttp2/transport/internal.h
@@ -485,7 +485,7 @@ struct grpc_chttp2_transport {
bool keepalive_permit_without_calls = false;
/** keep-alive state machine state */
grpc_chttp2_keepalive_state keepalive_state;
- grpc_core::ContextList* cl;
+ grpc_core::ContextList* cl = nullptr;
grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> channelz_socket;
uint32_t num_messages_in_next_write = 0;
};
@@ -640,6 +640,8 @@ struct grpc_chttp2_stream {
bool unprocessed_incoming_frames_decompressed = false;
/** gRPC header bytes that are already decompressed */
size_t decompressed_header_bytes = 0;
+ /** Whether the bytes needs to be traced using Fathom */
+ bool traced = false;
};
/** Transport writing call flow:
diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc
index 3b3367d0f3..77320b496f 100644
--- a/src/core/ext/transport/chttp2/transport/writing.cc
+++ b/src/core/ext/transport/chttp2/transport/writing.cc
@@ -488,8 +488,7 @@ class StreamWriteContext {
return; // early out: nothing to do
}
- if (/* traced && */ grpc_endpoint_can_track_err(t_->ep)) {
- gpr_log(GPR_INFO, "for transport %p", t_);
+ if (s_->traced && grpc_endpoint_can_track_err(t_->ep)) {
grpc_core::ContextList::Append(&t_->cl, s_);
}
while ((s_->flow_controlled_buffer.length > 0 ||