summaryrefslogtreecommitdiff
path: root/accel-pppd/ppp
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2014-05-12 13:50:15 +0400
committerDmitry Kozlov <xeb@mail.ru>2014-05-12 13:50:15 +0400
commit0c0bdd363b63319c7484f5cfbe6dd74a15b884be (patch)
tree1e5e4f596347cd80a57af5ca68b37eb27fcd91d5 /accel-pppd/ppp
parent7466e7f10fb4813a6112682dff13de5fbdd981a7 (diff)
downloadaccel-ppp-0c0bdd363b63319c7484f5cfbe6dd74a15b884be.tar.gz
accel-ppp-0c0bdd363b63319c7484f5cfbe6dd74a15b884be.zip
triton: improved epoll events handling
Diffstat (limited to 'accel-pppd/ppp')
-rw-r--r--accel-pppd/ppp/ppp.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/accel-pppd/ppp/ppp.c b/accel-pppd/ppp/ppp.c
index 53630946..6e024805 100644
--- a/accel-pppd/ppp/ppp.c
+++ b/accel-pppd/ppp/ppp.c
@@ -185,13 +185,14 @@ exit_close_chan:
static void destablish_ppp(struct ppp_t *ppp)
{
struct pppunit_cache *uc;
+ int close_unit = uc_size >= conf_unit_cache;
triton_event_fire(EV_SES_PRE_FINISHED, &ppp->ses);
- triton_md_unregister_handler(&ppp->chan_hnd);
- triton_md_unregister_handler(&ppp->unit_hnd);
+ triton_md_unregister_handler(&ppp->chan_hnd, 1);
+ triton_md_unregister_handler(&ppp->unit_hnd, close_unit);
- if (uc_size < conf_unit_cache) {
+ if (!close_unit) {
uc = mempool_alloc(uc_pool);
uc->fd = ppp->unit_fd;
uc->unit_idx = ppp->ses.unit_idx;
@@ -200,14 +201,11 @@ static void destablish_ppp(struct ppp_t *ppp)
list_add_tail(&uc->entry, &uc_list);
++uc_size;
pthread_mutex_unlock(&uc_lock);
- } else
- close(ppp->unit_fd);
+
+ ppp->chan_fd = -1;
+ }
- close(ppp->chan_fd);
close(ppp->fd);
-
- ppp->unit_fd = -1;
- ppp->chan_fd = -1;
ppp->fd = -1;
_free_layers(ppp);