static void nn_cipc_shutdown (struct nn_fsm *self, int src, int type, NN_UNUSED void *srcptr) { struct nn_cipc *cipc; cipc = nn_cont (self, struct nn_cipc, fsm); if (nn_slow (src == NN_FSM_ACTION && type == NN_FSM_STOP)) { if (!nn_sipc_isidle (&cipc->sipc)) { nn_ep_stat_increment (cipc->ep, NN_STAT_DROPPED_CONNECTIONS, 1); nn_sipc_stop (&cipc->sipc); } cipc->state = NN_CIPC_STATE_STOPPING_SIPC_FINAL; } if (nn_slow (cipc->state == NN_CIPC_STATE_STOPPING_SIPC_FINAL)) { if (!nn_sipc_isidle (&cipc->sipc)) return; nn_backoff_stop (&cipc->retry); nn_usock_stop (&cipc->usock); cipc->state = NN_CIPC_STATE_STOPPING; } if (nn_slow (cipc->state == NN_CIPC_STATE_STOPPING)) { if (!nn_backoff_isidle (&cipc->retry) || !nn_usock_isidle (&cipc->usock)) return; cipc->state = NN_CIPC_STATE_IDLE; nn_fsm_stopped_noevent (&cipc->fsm); nn_ep_stopped (cipc->ep); return; } nn_fsm_bad_state(cipc->state, src, type); }
static void nn_cws_shutdown (struct nn_fsm *self, int src, int type, NN_UNUSED void *srcptr) { struct nn_cws *cws; cws = nn_cont (self, struct nn_cws, fsm); if (nn_slow (src == NN_FSM_ACTION && type == NN_FSM_STOP)) { if (!nn_sws_isidle (&cws->sws)) { nn_ep_stat_increment (cws->ep, NN_STAT_DROPPED_CONNECTIONS, 1); nn_sws_stop (&cws->sws); } cws->state = NN_CWS_STATE_STOPPING_SWS_FINAL; } if (nn_slow (cws->state == NN_CWS_STATE_STOPPING_SWS_FINAL)) { if (!nn_sws_isidle (&cws->sws)) return; nn_backoff_stop (&cws->retry); nn_usock_stop (&cws->usock); nn_dns_stop (&cws->dns); cws->state = NN_CWS_STATE_STOPPING; } if (nn_slow (cws->state == NN_CWS_STATE_STOPPING)) { if (!nn_backoff_isidle (&cws->retry) || !nn_usock_isidle (&cws->usock) || !nn_dns_isidle (&cws->dns)) return; cws->state = NN_CWS_STATE_IDLE; nn_fsm_stopped_noevent (&cws->fsm); nn_ep_stopped (cws->ep); return; } nn_fsm_bad_state (cws->state, src, type); }
void nn_epbase_stopped (struct nn_epbase *self) { nn_ep_stopped (self->ep); }