summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/pppoe
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2015-11-23 11:21:58 +0300
committerDmitry Kozlov <xeb@mail.ru>2015-11-23 11:21:58 +0300
commitde64a4d20ad6d2cd0238ab9a0ee776f6086a4bfb (patch)
tree8f9b6354e56228a0801ca956ca8de36202c33538 /accel-pppd/ctrl/pppoe
parent9db2f5a3f429b749e9c12919135c2b225b25a912 (diff)
downloadaccel-ppp-de64a4d20ad6d2cd0238ab9a0ee776f6086a4bfb.tar.gz
accel-ppp-de64a4d20ad6d2cd0238ab9a0ee776f6086a4bfb.zip
pppoe: improved locking
Diffstat (limited to 'accel-pppd/ctrl/pppoe')
-rw-r--r--accel-pppd/ctrl/pppoe/pppoe.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c
index 25950e79..8d20507a 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.c
+++ b/accel-pppd/ctrl/pppoe/pppoe.c
@@ -150,7 +150,7 @@ static void pppoe_serv_start_timer(struct pppoe_serv_t *serv)
triton_timer_add(&serv->ctx, &serv->timer, 0);
pthread_mutex_unlock(&serv->lock);
} else {
- pthread_mutex_lock(&serv->lock);
+ pthread_mutex_unlock(&serv->lock);
pppoe_server_free(serv);
}
}
@@ -179,8 +179,8 @@ static void disconnect(struct pppoe_conn_t *conn)
pthread_mutex_unlock(&conn->serv->lock);
pppoe_server_free(conn->serv);
} else if (conn->serv->vid) {
- pthread_mutex_unlock(&conn->serv->lock);
triton_context_call(&conn->serv->ctx, (triton_event_func)pppoe_serv_start_timer, conn->serv);
+ pthread_mutex_unlock(&conn->serv->lock);
}
} else
pthread_mutex_unlock(&conn->serv->lock);
@@ -1273,12 +1273,15 @@ static void pppoe_serv_timeout(struct triton_timer_t *t)
{
struct pppoe_serv_t *serv = container_of(t, typeof(*serv), timer);
+ pthread_mutex_lock(&serv->lock);
if (serv->conn_cnt) {
triton_timer_del(&serv->timer);
+ pthread_mutex_unlock(&serv->lock);
return;
}
- _server_stop(serv);
+ pthread_mutex_unlock(&serv->lock);
+ pppoe_server_free(serv);
}
static int parse_server(const char *opt, int *padi_limit)