void proto_expectation_cleanup(struct proto_expectation *e) { if (!e) return; debug_expectation("Cleaning up expectation %p", e); while (e->head) { struct proto_expectation_stack *es = e->head; e->head = es->next; if (es->fields[POM_DIR_FWD]) ptype_cleanup(es->fields[POM_DIR_FWD]); if (es->fields[POM_DIR_REV]) ptype_cleanup(es->fields[POM_DIR_REV]); free(es); } if (e->session) conntrack_session_refcount_dec(e->session); timer_cleanup(e->expiry); free(e); }
int proto_expectation_expiry(void *priv, ptime now) { struct proto_expectation *e = priv; struct proto *proto = e->tail->proto; timer_cleanup(e->expiry); pom_rwlock_wlock(&proto->expectation_lock); if (e->next) e->next->prev = e->prev; if (e->prev) e->prev->next = e->next; else proto->expectations = e->next; pom_rwlock_unlock(&proto->expectation_lock); if (e->priv && proto->info->ct_info->cleanup_handler) { if (proto->info->ct_info->cleanup_handler(e->priv) != POM_OK) pomlog(POMLOG_WARN "Unable to free the conntrack priv of the proto_expectation"); } registry_perf_dec(e->proto->perf_expt_pending, 1); proto_expectation_cleanup(e); return POM_OK; }
/********************************************************************************************************************* ** Function name: mtimer_cleanup ** Descriptions: 卸载毫秒定时器 ** Input parameters: ** Output parameters: ** Returned value: ==OK : 操作成功 ** !=OK : 操作失败(包含出错信息) **-------------------------------------------------------------------------------------------------------------------- ** Created by: Feng Liang ** Created Date: 2012-2-10 0:18:47 ** Test recorde: **-------------------------------------------------------------------------------------------------------------------- ** Modified by: ** Modified date: ** Test recorde: *********************************************************************************************************************/ int mtimer_cleanup(void) { timer_cleanup(&mtimer_features); dword_clear_bits(PCONP, 1ul<<2); /* 禁能定时器1 */ return OK; }
int conntrack_timer_cleanup(struct conntrack_timer *t) { #ifdef DEBUG_CONNTRACK int res = pthread_mutex_lock(&t->ce->lock); if (!res) { pomlog(POMLOG_ERR "Internal error, conntrack not locked when timer cleaned up"); pom_mutex_unlock(&t->ce->lock); } else if (res != EDEADLK) { pomlog(POMLOG_ERR "Error while locking timer lock : %s", pom_strerror(errno)); abort(); } #endif timer_cleanup(t->timer); free(t); return POM_OK; }
int conntrack_delayed_cleanup(struct conntrack_entry *ce, unsigned int delay, ptime now) { if (!delay) { if (ce->cleanup_timer && ce->cleanup_timer != (void*)-1) { timer_dequeue(ce->cleanup_timer->timer); timer_cleanup(ce->cleanup_timer->timer); free(ce->cleanup_timer); ce->cleanup_timer = NULL; } return POM_OK; } if (ce->cleanup_timer == (void *) -1) { debug_conntrack("Not queuing timer for conntrack %p as it is currently being cleaned up", ce); return POM_OK; } if (!ce->cleanup_timer) { ce->cleanup_timer = malloc(sizeof(struct conntrack_timer)); if (!ce->cleanup_timer) { pom_oom(sizeof(struct conntrack_timer)); return POM_ERR; } ce->cleanup_timer->timer = timer_alloc(ce->cleanup_timer, conntrack_timed_cleanup); if (!ce->cleanup_timer->timer) { free(ce->cleanup_timer); ce->cleanup_timer = NULL; return POM_ERR; } ce->cleanup_timer->ce = ce; ce->cleanup_timer->proto = ce->proto; ce->cleanup_timer->hash = ce->hash; } timer_queue_now(ce->cleanup_timer->timer, delay, now); return POM_OK; }
void proto_expectation_cleanup(struct proto_expectation *e) { if (!e) return; if (e->flags & PROTO_EXPECTATION_FLAG_QUEUED) proto_expectation_remove(e); debug_expectation("Cleaning up expectation %p", e); while (e->head) { struct proto_expectation_stack *es = e->head; e->head = es->next; if (es->fields[POM_DIR_FWD]) ptype_cleanup(es->fields[POM_DIR_FWD]); if (es->fields[POM_DIR_REV]) ptype_cleanup(es->fields[POM_DIR_REV]); free(es); } if (e->priv && e->proto->info->ct_info->cleanup_handler) { if (e->proto->info->ct_info->cleanup_handler(e->priv) != POM_OK) pomlog(POMLOG_WARN "Unable to free the conntrack priv of the proto_expectation"); } if (e->session) conntrack_session_refcount_dec(e->session); if (e->expiry) timer_cleanup(e->expiry); if (e->callback_priv && e->callback_priv_cleanup) e->callback_priv_cleanup(e->callback_priv); free(e); }
static void __exit mod_cleanup(void) { timer_cleanup(); printk(KERN_INFO "Stopped heartbeat\n"); }