diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2015-11-18 12:47:27 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2015-11-18 12:47:27 +0300 |
commit | dd6a897125a984498536466174426b18ed870bcc (patch) | |
tree | 5ad33fc1bb4f24a591f575b0a99ac0e988846eb3 /accel-pppd/ppp | |
parent | cc773ecd1776610e8789e72415cb48d2d203712b (diff) | |
download | accel-ppp-dd6a897125a984498536466174426b18ed870bcc.tar.gz accel-ppp-dd6a897125a984498536466174426b18ed870bcc.zip |
ipoe: do not send immediate Accounting Stop in soft terminate mode
Diffstat (limited to 'accel-pppd/ppp')
-rw-r--r-- | accel-pppd/ppp/ppp.c | 30 | ||||
-rw-r--r-- | accel-pppd/ppp/ppp.h | 2 |
2 files changed, 17 insertions, 15 deletions
diff --git a/accel-pppd/ppp/ppp.c b/accel-pppd/ppp/ppp.c index 3a3b2fc..c47d8d9 100644 --- a/accel-pppd/ppp/ppp.c +++ b/accel-pppd/ppp/ppp.c @@ -236,13 +236,11 @@ static void destroy_ppp_channel(struct ppp_t *ppp) static void destablish_ppp(struct ppp_t *ppp) { - struct pppunit_cache *uc; + struct pppunit_cache *uc = NULL; if (ppp->unit_fd < 0) goto destroy_channel; - triton_event_fire(EV_SES_PRE_FINISHED, &ppp->ses); - if (conf_unit_cache) { struct ifreq ifr; @@ -256,15 +254,10 @@ static void destablish_ppp(struct ppp_t *ppp) } triton_md_unregister_handler(&ppp->unit_hnd, 0); + uc = mempool_alloc(uc_pool); uc->fd = ppp->unit_fd; uc->unit_idx = ppp->ses.unit_idx; - - pthread_mutex_lock(&uc_lock); - list_add_tail(&uc->entry, &uc_list); - if (++uc_size > conf_unit_cache) - pthread_cond_signal(&uc_cond); - pthread_mutex_unlock(&uc_lock); } else triton_md_unregister_handler(&ppp->unit_hnd, 1); @@ -275,6 +268,14 @@ skip: destroy_channel: destroy_ppp_channel(ppp); + + if (uc) { + pthread_mutex_lock(&uc_lock); + list_add_tail(&uc->entry, &uc_list); + if (++uc_size > conf_unit_cache) + pthread_cond_signal(&uc_cond); + pthread_mutex_unlock(&uc_lock); + } } static void *uc_thread(void *unused) @@ -524,7 +525,7 @@ void __export ppp_layer_finished(struct ppp_t *ppp, struct ppp_layer_data_t *d) destablish_ppp(ppp); } -void __export ppp_terminate(struct ap_session *ses, int hard) +int __export ppp_terminate(struct ap_session *ses, int hard) { struct ppp_t *ppp = container_of(ses, typeof(*ppp), ses); struct layer_node_t *n; @@ -533,7 +534,7 @@ void __export ppp_terminate(struct ap_session *ses, int hard) if (hard) { destablish_ppp(ppp); - return; + return 0; } list_for_each_entry(n,&ppp->layers,entry) { @@ -544,10 +545,11 @@ void __export ppp_terminate(struct ap_session *ses, int hard) } } } - if (s) - return; - destablish_ppp(ppp); + if (!s) + destablish_ppp(ppp); + + return 1; } void __export ppp_register_chan_handler(struct ppp_t *ppp,struct ppp_handler_t *h) diff --git a/accel-pppd/ppp/ppp.h b/accel-pppd/ppp/ppp.h index dfceacc..f0fbcd3 100644 --- a/accel-pppd/ppp/ppp.h +++ b/accel-pppd/ppp/ppp.h @@ -106,7 +106,7 @@ void ppp_layer_started(struct ppp_t *ppp,struct ppp_layer_data_t*); void ppp_layer_finished(struct ppp_t *ppp,struct ppp_layer_data_t*); void ppp_layer_passive(struct ppp_t *ppp,struct ppp_layer_data_t*); -void ppp_terminate(struct ap_session *ses, int hard); +int ppp_terminate(struct ap_session *ses, int hard); void ppp_register_chan_handler(struct ppp_t *, struct ppp_handler_t *); void ppp_register_unit_handler(struct ppp_t * ,struct ppp_handler_t *); |