clang-format

pull/1464/head
Yang Gao 10 years ago
parent f7d05b572b
commit c71a9d2b56
  1. 1
      src/core/profiling/basic_timers.c
  2. 9
      src/core/profiling/timers.h
  3. 4
      src/core/support/cpu_windows.c
  4. 19
      src/core/surface/call.c
  5. 7
      src/cpp/common/call.cc
  6. 7
      src/cpp/server/server.cc
  7. 4
      test/build/systemtap.c
  8. 7
      test/cpp/end2end/end2end_test.cc

@ -147,7 +147,6 @@ void grpc_timers_global_destroy(void) {
grpc_timers_log_destroy(grpc_timers_log_global);
}
#else /* !GRPC_BASIC_PROFILER */
void grpc_timers_global_init(void) {}
void grpc_timers_global_destroy(void) {}

@ -74,13 +74,16 @@ enum grpc_profiling_tags {
#if !(defined(GRPC_STAP_PROFILER) + defined(GRPC_BASIC_PROFILER))
/* No profiling. No-op all the things. */
#define GRPC_TIMER_MARK(tag, id) \
do {} while(0)
do { \
} while (0)
#define GRPC_TIMER_BEGIN(tag, id) \
do {} while(0)
do { \
} while (0)
#define GRPC_TIMER_END(tag, id) \
do {} while(0)
do { \
} while (0)
#else /* at least one profiler requested... */
/* ... hopefully only one. */

@ -43,8 +43,6 @@ unsigned gpr_cpu_num_cores(void) {
return si.dwNumberOfProcessors;
}
unsigned gpr_cpu_current_cpu(void) {
return GetCurrentProcessorNumber();
}
unsigned gpr_cpu_current_cpu(void) { return GetCurrentProcessorNumber(); }
#endif /* GPR_WIN32 */

@ -246,9 +246,8 @@ static int fill_send_ops(grpc_call *call, grpc_transport_op *op);
static void execute_op(grpc_call *call, grpc_transport_op *op);
static void recv_metadata(grpc_call *call, grpc_metadata_batch *metadata);
static void finish_read_ops(grpc_call *call);
static grpc_call_error grpc_call_cancel_with_status_internal(grpc_call *c,
grpc_status_code status,
const char *description,
static grpc_call_error grpc_call_cancel_with_status_internal(
grpc_call *c, grpc_status_code status, const char *description,
gpr_uint8 locked);
grpc_call *grpc_call_create(grpc_channel *channel, grpc_completion_queue *cq,
@ -631,7 +630,8 @@ static int begin_message(grpc_call *call, grpc_begin_message msg) {
gpr_asprintf(
&message, "Message terminated early; read %d bytes, expected %d",
(int)call->incoming_message.length, (int)call->incoming_message_length);
grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT, message, 1);
grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT,
message, 1);
gpr_free(message);
return 0;
}
@ -642,7 +642,8 @@ static int begin_message(grpc_call *call, grpc_begin_message msg) {
&message,
"Maximum message length of %d exceeded by a message of length %d",
grpc_channel_get_max_message_length(call->channel), msg.length);
grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT, message, 1);
grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT,
message, 1);
gpr_free(message);
return 0;
} else if (msg.length > 0) {
@ -675,7 +676,8 @@ static int add_slice_to_message(grpc_call *call, gpr_slice slice) {
gpr_asprintf(
&message, "Receiving message overflow; read %d bytes, expected %d",
(int)call->incoming_message.length, (int)call->incoming_message_length);
grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT, message, 1);
grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT,
message, 1);
gpr_free(message);
return 0;
} else if (call->incoming_message.length == call->incoming_message_length) {
@ -1003,9 +1005,8 @@ grpc_call_error grpc_call_cancel_with_status(grpc_call *c,
return grpc_call_cancel_with_status_internal(c, status, description, 0);
}
static grpc_call_error grpc_call_cancel_with_status_internal(grpc_call *c,
grpc_status_code status,
const char *description,
static grpc_call_error grpc_call_cancel_with_status_internal(
grpc_call *c, grpc_status_code status, const char *description,
gpr_uint8 locked) {
grpc_transport_op op;
grpc_mdstr *details =

@ -312,7 +312,8 @@ bool CallOpBuffer::FinalizeResult(void** tag, bool* status) {
got_message = *status;
if (recv_message_) {
GRPC_TIMER_BEGIN(GRPC_PTAG_PROTO_DESERIALIZE, 0);
*status = *status && DeserializeProto(recv_buf_, recv_message_, max_message_size_);
*status = *status &&
DeserializeProto(recv_buf_, recv_message_, max_message_size_);
grpc_byte_buffer_destroy(recv_buf_);
GRPC_TIMER_END(GRPC_PTAG_PROTO_DESERIALIZE, 0);
} else {
@ -343,7 +344,9 @@ Call::Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq)
Call::Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq,
int max_message_size)
: call_hook_(call_hook), cq_(cq), call_(call),
: call_hook_(call_hook),
cq_(cq),
call_(call),
max_message_size_(max_message_size) {}
void Call::PerformOps(CallOpBuffer* buffer) {

@ -126,7 +126,8 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag {
if (has_request_payload_) {
GRPC_TIMER_BEGIN(GRPC_PTAG_PROTO_DESERIALIZE, call_.call());
req.reset(method_->AllocateRequestProto());
if (!DeserializeProto(request_payload_, req.get(), call_.max_message_size())) {
if (!DeserializeProto(request_payload_, req.get(),
call_.max_message_size())) {
// FIXME(yangg) deal with deserialization failure
cq_.Shutdown();
return;
@ -364,8 +365,8 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag {
if (*status && request_) {
if (payload_) {
GRPC_TIMER_BEGIN(GRPC_PTAG_PROTO_DESERIALIZE, call_);
*status = DeserializeProto(payload_, request_,
server_->max_message_size_);
*status =
DeserializeProto(payload_, request_, server_->max_message_size_);
GRPC_TIMER_END(GRPC_PTAG_PROTO_DESERIALIZE, call_);
} else {
*status = false;

@ -37,6 +37,4 @@
#error "_SYS_SDT_H not defined, despite <sys/sdt.h> being present."
#endif
int main() {
return 0;
}
int main() { return 0; }

@ -182,7 +182,8 @@ class End2endTest : public ::testing::Test {
builder.AddListeningPort(server_address_.str(),
InsecureServerCredentials());
builder.RegisterService(&service_);
builder.SetMaxMessageSize(kMaxMessageSize_); // For testing max message size.
builder.SetMaxMessageSize(
kMaxMessageSize_); // For testing max message size.
builder.RegisterService(&dup_pkg_service_);
builder.SetThreadPool(&thread_pool_);
server_ = builder.BuildAndStart();
@ -428,8 +429,7 @@ TEST_F(End2endTest, DiffPackageServices) {
// rpc and stream should fail on bad credentials.
TEST_F(End2endTest, BadCredentials) {
std::unique_ptr<Credentials> bad_creds =
ServiceAccountCredentials("", "", 1);
std::unique_ptr<Credentials> bad_creds = ServiceAccountCredentials("", "", 1);
EXPECT_EQ(nullptr, bad_creds.get());
std::shared_ptr<ChannelInterface> channel =
CreateChannel(server_address_.str(), bad_creds, ChannelArguments());
@ -510,7 +510,6 @@ TEST_F(End2endTest, ClientCancelsRequestStream) {
EXPECT_EQ(grpc::StatusCode::CANCELLED, s.code());
EXPECT_EQ(response.message(), "");
}
// Client cancels server stream after sending some messages

Loading…
Cancel
Save