From 62e89248160d3592c2d754fcaa15e37586a5b091 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Sat, 20 Sep 2014 12:18:49 +0400 Subject: 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. --- accel-pppd/radius/packet.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'accel-pppd/radius/packet.c') diff --git a/accel-pppd/radius/packet.c b/accel-pppd/radius/packet.c index 5bff60a..87c337f 100644 --- a/accel-pppd/radius/packet.c +++ b/accel-pppd/radius/packet.c @@ -143,13 +143,14 @@ int rad_packet_recv(int fd, struct rad_packet_t **p, struct sockaddr_in *addr) else n = read(fd, pack->buf, REQ_LENGTH_MAX); if (n < 0) { - if (errno == EAGAIN) { - rad_packet_free(pack); - return -1; - } + rad_packet_free(pack); + if (errno == EAGAIN) + return 1; + if (errno != ECONNREFUSED) log_ppp_error("radius:packet:read: %s\n", strerror(errno)); - goto out_err; + + return -1; } break; } -- cgit v1.2.3