diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-06-04 16:28:28 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-06-04 16:28:28 +0400 |
commit | 11865d0baa7788c6a49c3f8bc0d552d2a3999bcb (patch) | |
tree | bb6e0212d634d07488096e402866a72b54ac2881 | |
parent | cfbc9780376c463a5977c455765d73f02102fee9 (diff) | |
download | accel-ppp-xebd-11865d0baa7788c6a49c3f8bc0d552d2a3999bcb.tar.gz accel-ppp-xebd-11865d0baa7788c6a49c3f8bc0d552d2a3999bcb.zip |
Revert "implemented delayed fd close (speeds up session termination process)"
Low interface creation/deletion rate is kernel issue and should be fixed in 3.5.
This reverts commit 9ae4a0151805229face3385e6c966de90c7fec29.
-rw-r--r-- | accel-pppd/CMakeLists.txt | 3 | ||||
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 8 | ||||
-rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 3 | ||||
-rw-r--r-- | accel-pppd/ctrl/pptp/pptp.c | 3 | ||||
-rw-r--r-- | accel-pppd/fdtrash.c | 31 | ||||
-rw-r--r-- | accel-pppd/include/fdtrash.h | 6 | ||||
-rw-r--r-- | accel-pppd/ppp/ppp.c | 7 |
7 files changed, 10 insertions, 51 deletions
diff --git a/accel-pppd/CMakeLists.txt b/accel-pppd/CMakeLists.txt index dc4b557..0702e5e 100644 --- a/accel-pppd/CMakeLists.txt +++ b/accel-pppd/CMakeLists.txt @@ -66,8 +66,9 @@ ADD_EXECUTABLE(accel-pppd pwdb.c ipdb.c - fdtrash.c + iprange.c + utils.c log.c diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index c629bb3..d8a98f8 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -26,7 +26,6 @@ #include "crypto.h" #include "connlimit.h" -#include "fdtrash.h" #include "memdebug.h" @@ -117,6 +116,7 @@ static void l2tp_disconnect(struct l2tp_conn_t *conn) struct l2tp_packet_t *pack; triton_md_unregister_handler(&conn->hnd); + close(conn->hnd.fd); if (conn->timeout_timer.tpd) triton_timer_del(&conn->timeout_timer); @@ -139,12 +139,10 @@ static void l2tp_disconnect(struct l2tp_conn_t *conn) pthread_mutex_unlock(&l2tp_lock); if (conn->ppp.fd != -1) - fdtrash_add(conn->ppp.fd); + close(conn->ppp.fd); if (conn->tunnel_fd != -1) - fdtrash_add(conn->tunnel_fd); - - fdtrash_add(conn->hnd.fd); + close(conn->tunnel_fd); triton_event_fire(EV_CTRL_FINISHED, &conn->ppp); diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index ddd61e7..73ddb91 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -27,7 +27,6 @@ #endif #include "connlimit.h" -#include "fdtrash.h" #include "pppoe.h" @@ -118,7 +117,7 @@ static void disconnect(struct pppoe_conn_t *conn) pppoe_send_PADT(conn); - fdtrash_add(conn->disc_sock); + close(conn->disc_sock); triton_event_fire(EV_CTRL_FINISHED, &conn->ppp); diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c index 9cbb51f..2f0c5ef 100644 --- a/accel-pppd/ctrl/pptp/pptp.c +++ b/accel-pppd/ctrl/pptp/pptp.c @@ -22,7 +22,6 @@ #include "iprange.h" #include "utils.h" #include "cli.h" -#include "fdtrash.h" #include "connlimit.h" @@ -77,7 +76,7 @@ static void disconnect(struct pptp_conn_t *conn) log_ppp_debug("pptp: disconnect\n"); triton_md_unregister_handler(&conn->hnd); - fdtrash_add(conn->hnd.fd); + close(conn->hnd.fd); if (conn->timeout_timer.tpd) triton_timer_del(&conn->timeout_timer); diff --git a/accel-pppd/fdtrash.c b/accel-pppd/fdtrash.c deleted file mode 100644 index c43de8d..0000000 --- a/accel-pppd/fdtrash.c +++ /dev/null @@ -1,31 +0,0 @@ -#include <unistd.h> - -#include "triton.h" -#include "fdtrash.h" - -static void fdtrash_close(struct triton_context_t *ctx) -{ - triton_context_unregister(ctx); -} - -struct triton_context_t ctx = { - .close = fdtrash_close, -}; - -static void __close(void *arg) -{ - close((long)arg); -} - -void __export fdtrash_add(long fd) -{ - triton_context_call(&ctx, (triton_event_func)__close, (void *)fd); -} - -static void init() -{ - triton_context_register(&ctx, NULL); - triton_context_wakeup(&ctx); -} - -DEFINE_INIT(10, init); diff --git a/accel-pppd/include/fdtrash.h b/accel-pppd/include/fdtrash.h deleted file mode 100644 index 4144573..0000000 --- a/accel-pppd/include/fdtrash.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __FDTRASH__H_ -#define __FDTRASH__H_ - -void fdtrash_add(long fd); - -#endif diff --git a/accel-pppd/ppp/ppp.c b/accel-pppd/ppp/ppp.c index ef8aa36..4f3beb9 100644 --- a/accel-pppd/ppp/ppp.c +++ b/accel-pppd/ppp/ppp.c @@ -19,7 +19,6 @@ #include "ppp.h" #include "ppp_fsm.h" #include "log.h" -#include "fdtrash.h" #include "spinlock.h" #include "mempool.h" @@ -224,9 +223,9 @@ static void destablish_ppp(struct ppp_t *ppp) triton_md_unregister_handler(&ppp->chan_hnd); triton_md_unregister_handler(&ppp->unit_hnd); - fdtrash_add(ppp->unit_fd); - fdtrash_add(ppp->chan_fd); - fdtrash_add(ppp->fd); + close(ppp->unit_fd); + close(ppp->chan_fd); + close(ppp->fd); ppp->unit_fd = -1; ppp->chan_fd = -1; |