Update by review 2

pull/24841/head
Esun Kim 4 years ago
parent 7d7c3cc711
commit 7182bd5309
  1. 3
      src/core/lib/iomgr/ev_epollex_linux.cc
  2. 10
      src/core/lib/iomgr/lockfree_event.cc
  3. 7
      src/core/lib/iomgr/unix_sockets_posix.cc
  4. 17
      src/core/lib/surface/call.cc
  5. 2
      src/core/tsi/alts/frame_protector/frame_handler.cc
  6. 2
      src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc
  7. 2
      src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc

@ -731,7 +731,8 @@ static grpc_error* pollset_kick(grpc_pollset* pollset,
GRPC_STATS_INC_POLLSET_KICK(); GRPC_STATS_INC_POLLSET_KICK();
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_INFO, gpr_log(GPR_INFO,
"PS:%p kick %p tls_pollset=%p tls_worker=%p pollset.root_worker=%p", "PS:%p kick %p tls_pollset=%" PRIxPTR " tls_worker=%" PRIxPTR
" pollset.root_worker=%p",
pollset, specific_worker, gpr_tls_get(&g_current_thread_pollset), pollset, specific_worker, gpr_tls_get(&g_current_thread_pollset),
gpr_tls_get(&g_current_thread_worker), pollset->root_worker); gpr_tls_get(&g_current_thread_worker), pollset->root_worker);
} }

@ -96,7 +96,8 @@ void LockfreeEvent::NotifyOn(grpc_closure* closure) {
* referencing it. */ * referencing it. */
gpr_atm curr = gpr_atm_acq_load(&state_); gpr_atm curr = gpr_atm_acq_load(&state_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_DEBUG, "LockfreeEvent::NotifyOn: %p curr=%p closure=%p", this, gpr_log(GPR_DEBUG,
"LockfreeEvent::NotifyOn: %p curr=%" PRIxPTR " closure=%p", this,
curr, closure); curr, closure);
} }
switch (curr) { switch (curr) {
@ -164,7 +165,8 @@ bool LockfreeEvent::SetShutdown(grpc_error* shutdown_error) {
while (true) { while (true) {
gpr_atm curr = gpr_atm_no_barrier_load(&state_); gpr_atm curr = gpr_atm_no_barrier_load(&state_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_DEBUG, "LockfreeEvent::SetShutdown: %p curr=%p err=%s", gpr_log(GPR_DEBUG,
"LockfreeEvent::SetShutdown: %p curr=%" PRIxPTR " err=%s",
&state_, curr, grpc_error_string(shutdown_error)); &state_, curr, grpc_error_string(shutdown_error));
} }
switch (curr) { switch (curr) {
@ -213,8 +215,8 @@ void LockfreeEvent::SetReady() {
gpr_atm curr = gpr_atm_no_barrier_load(&state_); gpr_atm curr = gpr_atm_no_barrier_load(&state_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) { if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_DEBUG, "LockfreeEvent::SetReady: %p curr=%p", &state_, gpr_log(GPR_DEBUG, "LockfreeEvent::SetReady: %p curr=%" PRIxPTR, &state_,
reinterpret_cast<void*>(curr)); curr);
} }
switch (curr) { switch (curr) {

@ -98,12 +98,11 @@ std::string grpc_sockaddr_to_uri_unix_if_possible(
} }
const auto* unix_addr = reinterpret_cast<const struct sockaddr_un*>(addr); const auto* unix_addr = reinterpret_cast<const struct sockaddr_un*>(addr);
if (unix_addr->sun_path[0] == '\0' && unix_addr->sun_path[1] != '\0') { if (unix_addr->sun_path[0] == '\0' && unix_addr->sun_path[1] != '\0') {
const struct sockaddr_un* un =
reinterpret_cast<const struct sockaddr_un*>(resolved_addr->addr);
return absl::StrCat( return absl::StrCat(
"unix-abstract:", "unix-abstract:",
absl::string_view(un->sun_path + 1, absl::string_view(
resolved_addr->len - sizeof(un->sun_family) - 1)); unix_addr->sun_path + 1,
resolved_addr->len - sizeof(unix_addr->sun_family) - 1));
} }
return absl::StrCat("unix:", unix_addr->sun_path); return absl::StrCat("unix:", unix_addr->sun_path);
} }

@ -889,8 +889,8 @@ grpc_call_test_only_get_incoming_stream_encodings(grpc_call* call) {
return call->incoming_stream_compression_algorithm; return call->incoming_stream_compression_algorithm;
} }
static const grpc_linked_mdelem* linked_from_md(const grpc_metadata* md) { static grpc_linked_mdelem* linked_from_md(grpc_metadata* md) {
return reinterpret_cast<const grpc_linked_mdelem*>(&md->internal_data); return reinterpret_cast<grpc_linked_mdelem*>(&md->internal_data);
} }
static grpc_metadata* get_md_elem(grpc_metadata* metadata, static grpc_metadata* get_md_elem(grpc_metadata* metadata,
@ -913,9 +913,8 @@ static int prepare_application_metadata(grpc_call* call, int count,
grpc_metadata_batch* batch = grpc_metadata_batch* batch =
&call->metadata_batch[0 /* is_receiving */][is_trailing]; &call->metadata_batch[0 /* is_receiving */][is_trailing];
for (i = 0; i < total_count; i++) { for (i = 0; i < total_count; i++) {
const grpc_metadata* md = grpc_metadata* md = get_md_elem(metadata, additional_metadata, i, count);
get_md_elem(metadata, additional_metadata, i, count); grpc_linked_mdelem* l = linked_from_md(md);
grpc_linked_mdelem* l = const_cast<grpc_linked_mdelem*>(linked_from_md(md));
GPR_ASSERT(sizeof(grpc_linked_mdelem) == sizeof(md->internal_data)); GPR_ASSERT(sizeof(grpc_linked_mdelem) == sizeof(md->internal_data));
if (!GRPC_LOG_IF_ERROR("validate_metadata", if (!GRPC_LOG_IF_ERROR("validate_metadata",
grpc_validate_header_key_is_legal(md->key))) { grpc_validate_header_key_is_legal(md->key))) {
@ -933,10 +932,8 @@ static int prepare_application_metadata(grpc_call* call, int count,
} }
if (i != total_count) { if (i != total_count) {
for (int j = 0; j < i; j++) { for (int j = 0; j < i; j++) {
const grpc_metadata* md = grpc_metadata* md = get_md_elem(metadata, additional_metadata, j, count);
get_md_elem(metadata, additional_metadata, j, count); grpc_linked_mdelem* l = linked_from_md(md);
grpc_linked_mdelem* l =
const_cast<grpc_linked_mdelem*>(linked_from_md(md));
GRPC_MDELEM_UNREF(l->md); GRPC_MDELEM_UNREF(l->md);
} }
return 0; return 0;
@ -954,7 +951,7 @@ static int prepare_application_metadata(grpc_call* call, int count,
} }
for (i = 0; i < total_count; i++) { for (i = 0; i < total_count; i++) {
grpc_metadata* md = get_md_elem(metadata, additional_metadata, i, count); grpc_metadata* md = get_md_elem(metadata, additional_metadata, i, count);
grpc_linked_mdelem* l = const_cast<grpc_linked_mdelem*>(linked_from_md(md)); grpc_linked_mdelem* l = linked_from_md(md);
grpc_error* error = grpc_metadata_batch_link_tail(batch, l); grpc_error* error = grpc_metadata_batch_link_tail(batch, l);
if (error != GRPC_ERROR_NONE) { if (error != GRPC_ERROR_NONE) {
GRPC_MDELEM_UNREF(l->md); GRPC_MDELEM_UNREF(l->md);

@ -34,7 +34,7 @@ static uint32_t load_32_le(const unsigned char* buffer) {
return (static_cast<uint32_t>(buffer[3]) << 24) | return (static_cast<uint32_t>(buffer[3]) << 24) |
(static_cast<uint32_t>(buffer[2]) << 16) | (static_cast<uint32_t>(buffer[2]) << 16) |
(static_cast<uint32_t>(buffer[1]) << 8) | (static_cast<uint32_t>(buffer[1]) << 8) |
(static_cast<uint32_t>(buffer[0])); static_cast<uint32_t>(buffer[0]);
} }
/* Store uint32_t as a string of little endian bytes. */ /* Store uint32_t as a string of little endian bytes. */

@ -59,7 +59,7 @@ static uint32_t load_32_le(const unsigned char* buffer) {
return (static_cast<uint32_t>(buffer[3]) << 24) | return (static_cast<uint32_t>(buffer[3]) << 24) |
(static_cast<uint32_t>(buffer[2]) << 16) | (static_cast<uint32_t>(buffer[2]) << 16) |
(static_cast<uint32_t>(buffer[1]) << 8) | (static_cast<uint32_t>(buffer[1]) << 8) |
(static_cast<uint32_t>(buffer[0])); static_cast<uint32_t>(buffer[0]);
} }
/* Store uint32_t as a string of little endian bytes. */ /* Store uint32_t as a string of little endian bytes. */

@ -90,7 +90,7 @@ static bool read_frame_size(const grpc_slice_buffer* sb,
uint32_t frame_size = (static_cast<uint32_t>(frame_size_buffer[3]) << 24) | uint32_t frame_size = (static_cast<uint32_t>(frame_size_buffer[3]) << 24) |
(static_cast<uint32_t>(frame_size_buffer[2]) << 16) | (static_cast<uint32_t>(frame_size_buffer[2]) << 16) |
(static_cast<uint32_t>(frame_size_buffer[1]) << 8) | (static_cast<uint32_t>(frame_size_buffer[1]) << 8) |
(static_cast<uint32_t>(frame_size_buffer[0])); static_cast<uint32_t>(frame_size_buffer[0]);
if (frame_size > kMaxFrameLength) { if (frame_size > kMaxFrameLength) {
gpr_log(GPR_ERROR, "Frame size is larger than maximum frame size"); gpr_log(GPR_ERROR, "Frame size is larger than maximum frame size");
return false; return false;

Loading…
Cancel
Save