diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2014-09-20 12:18:49 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-09-20 12:18:49 +0400 |
commit | 62e89248160d3592c2d754fcaa15e37586a5b091 (patch) | |
tree | a6513cfd1e8ef6c6079ea2436e8573b122cc1ec6 /accel-pppd/ifcfg.c | |
parent | 0a58c20b44136c1fba996becea18696b3f67a1f9 (diff) | |
download | accel-ppp-62e89248160d3592c2d754fcaa15e37586a5b091.tar.gz accel-ppp-62e89248160d3592c2d754fcaa15e37586a5b091.zip |
rewrite of authentication/accounting procedures
This patch gets rid of synchronuos style of authentication/accounting.
Synchronous style of authentication/accounting produced sleeping threads
which becomes a problem when lots of sessions started/stopped and all they want authorization/accounting.
Diffstat (limited to 'accel-pppd/ifcfg.c')
-rw-r--r-- | accel-pppd/ifcfg.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/accel-pppd/ifcfg.c b/accel-pppd/ifcfg.c index d3a8006c..c48011ec 100644 --- a/accel-pppd/ifcfg.c +++ b/accel-pppd/ifcfg.c @@ -55,7 +55,6 @@ static void build_addr(struct ipv6db_addr_t *a, uint64_t intf_id, struct in6_add *(uint64_t *)(addr->s6_addr + 8) |= intf_id & ((1 << (128 - a->prefix_len)) - 1); } -static void ifup_continue(struct ap_session *ses); void ap_session_ifup(struct ap_session *ses) { if (ses->ifname_rename) { @@ -66,12 +65,19 @@ void ap_session_ifup(struct ap_session *ses) _free(ses->ifname_rename); ses->ifname_rename = NULL; } - + triton_event_fire(EV_SES_ACCT_START, ses); - triton_context_call(ses->ctrl->ctx, (triton_event_func)ifup_continue, ses); + + if (ses->stop_time) + return; + + if (!ses->acct_start) { + ses->acct_start = 1; + ap_session_accounting_started(ses); + } } -static void ifup_continue(struct ap_session *ses) +void __export ap_session_accounting_started(struct ap_session *ses) { struct ipv6db_addr_t *a; struct ifreq ifr; @@ -84,10 +90,13 @@ static void ifup_continue(struct ap_session *ses) if (ses->stop_time) return; + if (--ses->acct_start) + return; + triton_event_fire(EV_SES_PRE_UP, ses); if (ses->stop_time) return; - + memset(&ifr, 0, sizeof(ifr)); strcpy(ifr.ifr_name, ses->ifname); |