Remove argument to grpc_em_alarm_cancel as it isn't used.

Change on 2014/12/01 by vpai <vpai@google.com>
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=81088661
pull/1/merge
vpai 10 years ago committed by Nicolas Noble
parent 29e1d295ef
commit 8ac074ba20
  1. 3
      src/core/channel/client_setup.c
  2. 4
      src/core/eventmanager/em.c
  3. 2
      src/core/eventmanager/em.h
  4. 6
      src/core/surface/call.c
  5. 7
      test/core/eventmanager/em_test.c

@ -108,7 +108,6 @@ static void setup_initiate(grpc_transport_setup *sp) {
not to initiate again) */ not to initiate again) */
static void setup_cancel(grpc_transport_setup *sp) { static void setup_cancel(grpc_transport_setup *sp) {
grpc_client_setup *s = (grpc_client_setup *)sp; grpc_client_setup *s = (grpc_client_setup *)sp;
void *ignored;
gpr_mu_lock(&s->mu); gpr_mu_lock(&s->mu);
@ -116,7 +115,7 @@ static void setup_cancel(grpc_transport_setup *sp) {
/* effectively cancels the current request (if any) */ /* effectively cancels the current request (if any) */
s->active_request = NULL; s->active_request = NULL;
if (s->in_alarm) { if (s->in_alarm) {
grpc_em_alarm_cancel(&s->backoff_alarm, &ignored); grpc_em_alarm_cancel(&s->backoff_alarm);
} }
if (--s->refs == 0) { if (--s->refs == 0) {
gpr_mu_unlock(&s->mu); gpr_mu_unlock(&s->mu);

@ -340,12 +340,10 @@ grpc_em_error grpc_em_alarm_add(grpc_em_alarm *alarm, gpr_timespec deadline) {
} }
} }
grpc_em_error grpc_em_alarm_cancel(grpc_em_alarm *alarm, void **arg) { grpc_em_error grpc_em_alarm_cancel(grpc_em_alarm *alarm) {
grpc_em_activation_data *adata = &alarm->task.activation[GRPC_EM_TA_ONLY]; grpc_em_activation_data *adata = &alarm->task.activation[GRPC_EM_TA_ONLY];
int trigger_old; int trigger_old;
*arg = adata->arg;
/* First check if this alarm has been triggered, atomically */ /* First check if this alarm has been triggered, atomically */
trigger_old = trigger_old =
gpr_atm_full_fetch_add(&alarm->triggered, ALARM_TRIGGER_INCREMENT); gpr_atm_full_fetch_add(&alarm->triggered, ALARM_TRIGGER_INCREMENT);

@ -136,7 +136,7 @@ grpc_em_error grpc_em_alarm_add(grpc_em_alarm *alarm, gpr_timespec deadline);
or from the activation (with status SUCCESS) or from the activation (with status SUCCESS)
Requires: cancel() must happen after add() on a given alarm */ Requires: cancel() must happen after add() on a given alarm */
grpc_em_error grpc_em_alarm_cancel(grpc_em_alarm *alarm, void **arg); grpc_em_error grpc_em_alarm_cancel(grpc_em_alarm *alarm);
/* ========================== grpc_em_fd ============================= */ /* ========================== grpc_em_fd ============================= */

@ -253,8 +253,7 @@ void grpc_call_internal_unref(grpc_call *c) {
void grpc_call_destroy(grpc_call *c) { void grpc_call_destroy(grpc_call *c) {
gpr_mu_lock(&c->read_mu); gpr_mu_lock(&c->read_mu);
if (c->have_alarm) { if (c->have_alarm) {
void *arg_was; grpc_em_alarm_cancel(&c->alarm);
grpc_em_alarm_cancel(&c->alarm, &arg_was);
c->have_alarm = 0; c->have_alarm = 0;
} }
gpr_mu_unlock(&c->read_mu); gpr_mu_unlock(&c->read_mu);
@ -774,8 +773,7 @@ void grpc_call_recv_finish(grpc_call_element *elem, int is_full_close) {
} }
if (is_full_close) { if (is_full_close) {
if (call->have_alarm) { if (call->have_alarm) {
void *arg_was; grpc_em_alarm_cancel(&call->alarm);
grpc_em_alarm_cancel(&call->alarm, &arg_was);
call->have_alarm = 0; call->have_alarm = 0;
} }
call->received_finish = 1; call->received_finish = 1;

@ -580,7 +580,6 @@ static void test_grpc_em_alarm() {
gpr_timespec alarm_deadline; gpr_timespec alarm_deadline;
gpr_timespec followup_deadline; gpr_timespec followup_deadline;
alarm_arg *cancel_arg = NULL;
alarm_arg arg; alarm_arg arg;
alarm_arg arg2; alarm_arg arg2;
void *fdone; void *fdone;
@ -649,7 +648,7 @@ static void test_grpc_em_alarm() {
GRPC_EM_OK); GRPC_EM_OK);
GPR_ASSERT(grpc_em_alarm_add(&alarm_to_cancel, GPR_ASSERT(grpc_em_alarm_add(&alarm_to_cancel,
gpr_time_add(tv2, gpr_now())) == GRPC_EM_OK); gpr_time_add(tv2, gpr_now())) == GRPC_EM_OK);
switch (grpc_em_alarm_cancel(&alarm_to_cancel, (void **)&cancel_arg)) { switch (grpc_em_alarm_cancel(&alarm_to_cancel)) {
case GRPC_EM_OK: case GRPC_EM_OK:
gpr_log(GPR_INFO, "Alarm cancel succeeded"); gpr_log(GPR_INFO, "Alarm cancel succeeded");
break; break;
@ -700,10 +699,6 @@ static void test_grpc_em_alarm() {
GPR_ASSERT(0); GPR_ASSERT(0);
} }
if (cancel_arg != &arg2) {
gpr_log(GPR_ERROR, "Alarm cancel arg address wrong");
GPR_ASSERT(0);
}
if (fdone != (void *)&arg2.fcb_arg) { if (fdone != (void *)&arg2.fcb_arg) {
gpr_log(GPR_ERROR, "Followup callback #2 not invoked properly %p %p", fdone, gpr_log(GPR_ERROR, "Followup callback #2 not invoked properly %p %p", fdone,
&arg2.fcb_arg); &arg2.fcb_arg);

Loading…
Cancel
Save