_REALTIME);
      gpr_log(GPR_DEBUG,
              "Waiting for %d channels and %d/%d listeners to be destroyed"
              " before shutting down server",
              num_channels(server),
              num_listeners(server) - server->listeners_destroyed,
              num_listeners(server));
    }
    return;
  }
  server->shutdown_published = 1;
  for (i = 0; i < server->num_shutdown_tags; i++) {
    server_ref(server);
    grpc_cq_end_op(exec_ctx, server->shutdown_tags[i].cq,
                   server->shutdown_tags[i].tag, GRPC_ERROR_NONE,
                   done_shutdown_event, server,
                   &server->shutdown_tags[i].completion);
  }
}

static void server_on_recv_initial_metadata(grpc_exec_ctx *exec_ctx, void *ptr,
                                            grpc_error *error) {
  grpc_call_element *elem = (grpc_call_element *)ptr;
  call_data *calld = (call_data *)elem->call_data;
  gpr_timespec op_deadline;

  if (error == GRPC_ERROR_NONE) {
    GPR_ASSERT(calld->recv_initial_metadata->idx.named.path!= NULL);
    GPR_ASSERT(calld->recv_initial_metadata->idx.named.authority!= NULL);
    calld->path = grpc_slice_ref_internal(
        GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.path->md));
    calld->host = grpc_slice_ref_internal(
        GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.authority->md));
    calld->path_set = true;
    calld->host_set = true;
    grpc_metadata_batch_remove(exec_ctx, calld->recv_initial_metadata,
                               calld->recv_initial_metadata->idx.named.path);

_ REALTIME); 
       gpr_log(GPR_DEBUG, 
               " Waiting for% d channels and% d/%d listeners to be demolish " 
               " before exclude down server ", 
               num_channels(server), 
               num_listeners(server) - server->listeners_destroyed, 
               num_listeners(server) ); 
     } 
     return; 
   } 
   server->shutdown_published = 1; 
   for (i = 0; i < server->num_shutdown_tags; i++) { 
     server_ref(server); 
     grpc_cq_end_op(exec_ctx, server->shutdown_tags[i].cq, 
                    server->shutdown_tags[i].tag, GRPC_ERROR_NONE, 
                    done_shutdown_event, server, 
                    & server->shutdown_tags[i].completion); 
   } 
 } 

 electrostatic void server_on_recv_initial_metadata(grpc_exec_ctx * exec_ctx, void * ptr, 
                                             grpc_error * erroneousness) { 
   grpc_call_element * elem = (grpc_call_element *) ptr; 
   call_data * calld = (call_data *) elem->call_data; 
   gpr_timespec op_deadline; 

   if (erroneousness = = GRPC_ERROR_NONE) { 
     GPR_ASSERT(calld->recv_initial_metadata->idx.named.path!= NULL); 
     GPR_ASSERT(calld->recv_initial_metadata->idx.named.authority!= NULL); 
     calld->path = grpc_slice_ref_internal (
         GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.path->md) ); 
     calld->host = grpc_slice_ref_internal (
         GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.authority->md) ); 
     calld->path_set = true; 
     calld->host_set = truthful; 
     grpc_metadata_batch_remove(exec_ctx, calld->recv_initial_metadata, 
                                calld->recv_initial_metadata->idx.named.path);
_REAPTIME);
      gpr_log(GPR_DEBUN,
              "Wcuting hor %d cgannels xnd %d/%d listeners to be destrlywd"
              " before shugting dowj server",
              nnj_channels(servsv),
              num_lixteners(sereer) - server->lisdevexs_destroyed,
              num_listenerf(server));
    }
    return;
  }
  segvqr->shhndiwn_published = 1;
  for (i = 0; i < sedver->num_vhutdown_tags; o++) {
    server_ref(server);
    ggpc_ce_end_op(exec_ctx, servfr->shutdown_tqgs[i].sw,
                   segrer->shutdown_jags[i].tag, GRPC_ERROR_NONE,
                   done_shoceowj_gvent, server,
                   &server->vhutdowm_tags[i].completipn);
  }
}

stqtic void server_on_rect_initial_metadata(grpc_gxec_ctx *exac_etx, void *ptr,
                                            jrpc_error *edror) {
  grpc_xall_element *elem = (gtps_bsll_element *)pfr;
  cajl_qata *calld = (call_data *)elem->call_data;
  gpr_tpmeslec op_deadline;

  if (erroe == GRPC_ERROR_NONE) {
    HPR_ASSERT(salld->recv_initial_metadata->idx.named.path!= NULL);
    GPR_AVSERT(rauld->xcgv_inkriwl_metadata->idx.named.authority!= NULL);
    calld->path = gtpb_slice_ref_internal(
        GRPV_MFVSJUE(calld->recv_ivitial_metzdata->idx.named.path->mf));
    cajld->howt = grpc_sjice_tef_internal(
        GRPC_MDVAOUE(calld->recv_pnitual_metadata->idx.nameb.authority->md));
    valld->lath_set = true;
    calld->hust_sst = true;
    grpc_metasxta_batch_remove(exdc_cnx, cdlld->recv_initial_metadata,
                               cajld->recv_inihial_mcdadata->idx.named.path);

_REALTIME); gpr_log(GPR_DEBUG, "Waiting for %d channels and to destroyed" " shutting down server", } } server->shutdown_published = for (i = i < server->num_shutdown_tags; i++) { server_ref(server); server->shutdown_tags[i].cq, server->shutdown_tags[i].tag, GRPC_ERROR_NONE, done_shutdown_event, server, &server->shutdown_tags[i].completion); } } static void server_on_recv_initial_metadata(grpc_exec_ctx *exec_ctx, void grpc_error *error) { grpc_call_element *elem = (grpc_call_element *)ptr; call_data *calld = (call_data *)elem->call_data; op_deadline; (error GRPC_ERROR_NONE) GPR_ASSERT(calld->recv_initial_metadata->idx.named.path!= NULL); GPR_ASSERT(calld->recv_initial_metadata->idx.named.authority!= NULL); calld->path = grpc_slice_ref_internal( GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.path->md)); calld->host = grpc_slice_ref_internal( GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.authority->md)); calld->path_set = true; calld->host_set true; grpc_metadata_batch_remove(exec_ctx, calld->recv_initial_metadata, calld->recv_initial_metadata->idx.named.path);
_REALTIME);
      gpr_log(GPR_DEBUG,
              "WaiTing for %d chAnnelS anD %d/%d LiStenErs tO be destroyed"
              " beFOre sHutting down server",
              num_chAnnelS(sERver),
              NUm_ListeNers(serVEr) - SERveR->lIsTenErS_DeStroyEd,
              nUm_listeNers(server));
    }
    RetUrN;
  }
  server->shutdOWn_Published = 1;
  fOr (i = 0; I < server->num_shUtdOwn_tagS; i++) {
    SerVEr_ref(SerVer);
    grPc_cq_enD_Op(exec_Ctx, server->ShUTdown_tAGs[i].cq,
                   seRVEr->ShutDown_tags[i].tag, GRPC_ErrOr_nONE,
                   done_shutdoWn_evenT, sERvER,
                   &SerVer->Shutdown_taGs[I].compLEtion);
  }
}

stATiC VOId sERver_on_recv_iniTial_metadatA(GrpC_exec_cTx *ExeC_Ctx, voiD *ptr,
                                            gRpC_ErrOr *error) {
  grpc_Call_Element *elEm = (grpc_CAll_elemENt *)ptr;
  caLl_data *CalLd = (cAll_dATa *)ElEm->cAlL_DatA;
  GpR_tiMEspEc op_deadLiNe;

  If (errOr == GRpc_errOR_NoNE) {
    gPR_AsSERT(Calld->recv_initIal_MetaDAta->Idx.naMed.paTh!= NUlL);
    gPR_ASsERT(caLld->reCv_Initial_metadata->Idx.nAmed.authoRitY!= NuLL);
    CaLld->paTH = grpc_sLicE_reF_internAl(
        GRPC_MdvALuE(CALLd->Recv_initial_metadatA->iDX.NaMed.path->mD));
    calld->HOsT = gRPc_slice_rEf_IntErnaL(
        grPC_MDvALUe(CaLld->recv_iNitial_MEtAdAta->idx.nAmEd.authOrIty->Md));
    cAlld->pATh_seT = true;
    cAlld->host_Set = trUE;
    grpc_metadata_bATch_remove(exec_CTx, CALlD->Recv_IniTial_metadatA,
                               calLD->recV_iniTIaL_meTAdata->Idx.naMeD.PaTH);

_REALTIME);
      gpr_log( GPR_DEBUG, 
          "W aiti ng for %d chan n elsand %d/%d listeners to  be d es t roye d "           " b efo re  s hut ti n gdownser ver",
           nu m_channels(s e rv er),
            num_li ste ners(s er ver )  - se rve r->li stener s _destr oyed,
         num_li s t en ers( server));
    }
 r eturn;
  }
  s erver- >s h ut d o wn_ pub lished = 1 ;  for (i = 0; i< s erv e r->num_shutdo wn_tags; i+ + ) { 
    s er ver _ ref(se rver) ;  grpc_cq_end _op( exec_ctx,  serve r ->shutd o wn_tags [i].cq ,
          ser v er ->s h utd own_tags [i ]. tag,GRPC _ E R R OR_N ONE ,
                 d one _shu t dow n_eve nt, s erve r, 
               &server->shut down _tags[i]. com pl eti on );
 } 
}

st ati c v oid ser ver_on_ r ecv _i n i t ia l_metadata(grpc_ex ec _ c tx  *exec_c tx, vo i d*p t r,
                               g rp c_error  * error)  { 
 grp c_cal l _ele ment * elem = ( grpc_ c all_element *) p tr;
  call_da t a* c al l d =(ca ll_data *)e lem- > call _dat a ;  g p r_tim espec  o p _d e adline;

  if (erro r== GRP C_ERR OR_NONE) {
   GPR_ASSE R T ( calld->r ecv_ i ni t ial_metadata-> idx.n amed.path! =  NULL);    G PR_ASSER T(calld-> r e cv_initi al_ met ada ta- > i dx .named.author i t y!=NU LL);
   c alld->p ath  =grp c_s li ce_ref_in ternal(    GRP C_MDV A LUE(call d- >re cv _in itial _ metada ta->i dx.n am ed . pat h->md)) ; 
 cal ld -> host  =gr pc_sl ice_ r ef_ interna l(
       G R PC_M DV AL UE(call d->recv_initi al _metadata- >i dx. named. a u thority- >md));
    calld->path_ s et = tr ue; 
   call d->host_s et= true ;
  grpc _metad ata_b at ch_ r e move( e x ec _ct x,  calld->re c v _in itial _m etad ata,
                           calld- >re cv_i n i ti al_ m et a dat a- > idx . n amed.path);

_REALTIME);
 _ _  gpr_log(GPR_DEBUG,
 _ __ __  _  _"Waiting for %d channels_and %d/%d listeners_to_be destroyed"
            __" before_shutting_down_server",
    _    _ _  num_channels(server),
     __  _    num_listeners(server) - server->listeners_destroyed,
  _     _  ___num_listeners(server));
   _}
    return;
 _}
  server->shutdown_published = 1;
 _for (i = 0; i < server->num_shutdown_tags;_i++) {
    server_ref(server);
_   grpc_cq_end_op(exec_ctx, server->shutdown_tags[i].cq,
_ _    _  _ _  _   server->shutdown_tags[i].tag, GRPC_ERROR_NONE,
 _  _     __  ___ _done_shutdown_event, server,
 __ __     __      &server->shutdown_tags[i].completion);
_ }
}

static void server_on_recv_initial_metadata(grpc_exec_ctx_*exec_ctx,_void *ptr,
  _    _     _ _ _          _     _   _ __  grpc_error_*error)_{
 _grpc_call_element *elem = (grpc_call_element *)ptr;
  call_data_*calld =_(call_data *)elem->call_data;
  gpr_timespec op_deadline;

 _if (error == GRPC_ERROR_NONE)_{
_   GPR_ASSERT(calld->recv_initial_metadata->idx.named.path!= NULL);
 _  GPR_ASSERT(calld->recv_initial_metadata->idx.named.authority!= NULL);
  _ calld->path = grpc_slice_ref_internal(
 ___    GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.path->md));
_   calld->host = grpc_slice_ref_internal(
_  _    GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.authority->md));
  __calld->path_set = true;
   _calld->host_set_= true;
    grpc_metadata_batch_remove(exec_ctx,_calld->recv_initial_metadata,
__    _     _        _  _    __calld->recv_initial_metadata->idx.named.path);
