From 47551f1759b9dd9b0c2c5702710724e3f84b3c27 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Mon, 16 Sep 2002 15:39:00 +0000 Subject: [PATCH] Heartbeat context is not freed automatically by the library anymore. --- CHANGES | 5 +++++ apps/silcd/server.c | 11 +++++------ lib/silcutil/silcsockconn.c | 2 -- lib/silcutil/silcsockconn.h | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index e0861f00..2d2a9e41 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,11 @@ Mon Sep 16 12:02:54 EEST 2002 Pekka Riikonen in task callback functions. Affected files are lib/silcutil/silcutil.[ch]. + * The hb_context in SilcSocketConnection is not freed + automatically anymore (application must free it). Freeing + it automatic is inconsistent. Affected files are + lib/silcutil/silcsockconn.[ch]. + Sun Sep 15 22:16:19 EEST 2002 Pekka Riikonen * Added support for removing explicitly added client connections diff --git a/apps/silcd/server.c b/apps/silcd/server.c index d75fdd80..c2d60f96 100644 --- a/apps/silcd/server.c +++ b/apps/silcd/server.c @@ -252,10 +252,10 @@ bool silc_server_init_secondary(SilcServer server) newsocket->user_data = (void *)server->id_entry; silc_schedule_task_add(server->schedule, sock_list[sock], - silc_server_accept_new_connection, - (void *)server, 0, 0, - SILC_TASK_FD, - SILC_TASK_PRI_NORMAL); + silc_server_accept_new_connection, + (void *)server, 0, 0, + SILC_TASK_FD, + SILC_TASK_PRI_NORMAL); } return TRUE; @@ -1469,8 +1469,6 @@ silc_server_accept_new_connection_lookup(SilcSocketConnection sock, SilcServerConfigDeny *deny; int port; - context = (void *)server; - /* Check whether we could resolve both IP and FQDN. */ if (!sock->ip || (!strcmp(sock->ip, sock->hostname) && server->config->require_reverse_lookup)) { @@ -1491,6 +1489,7 @@ silc_server_accept_new_connection_lookup(SilcSocketConnection sock, However, this doesn't set the scheduler for outgoing traffic, it will be set separately by calling SILC_SET_CONNECTION_FOR_OUTPUT, later when outgoing data is available. */ + context = (void *)server; SILC_REGISTER_CONNECTION_FOR_IO(sock->sock); SILC_LOG_INFO(("Incoming connection %s (%s)", sock->hostname, diff --git a/lib/silcutil/silcsockconn.c b/lib/silcutil/silcsockconn.c index c32aaf8c..25a56fe1 100644 --- a/lib/silcutil/silcsockconn.c +++ b/lib/silcutil/silcsockconn.c @@ -73,7 +73,6 @@ void silc_socket_free(SilcSocketConnection sock) silc_buffer_free(sock->outbuf); if (sock->hb) { silc_schedule_task_del(sock->hb->schedule, sock->hb->hb_task); - silc_free(sock->hb->hb_context); silc_free(sock->hb); } @@ -130,7 +129,6 @@ void silc_socket_set_heartbeat(SilcSocketConnection sock, { if (sock->hb) { silc_schedule_task_del(schedule, sock->hb->hb_task); - silc_free(sock->hb->hb_context); silc_free(sock->hb); } diff --git a/lib/silcutil/silcsockconn.h b/lib/silcutil/silcsockconn.h index a78f3939..6507e269 100644 --- a/lib/silcutil/silcsockconn.h +++ b/lib/silcutil/silcsockconn.h @@ -373,8 +373,8 @@ typedef void (*SilcSocketConnectionHBCb)(SilcSocketConnection sock, * allocated by the application and will be sent as argument to the * `hb_callback' function that is called when the `heartbeat' timeout * expires. The callback `hb_context' won't be touched by the library - * but will be freed automatically when calling silc_socket_free. The - * `schedule' is the application's scheduler. + * but and must be freed by the application. The `schedule' is the + * application's scheduler. * ***/ void silc_socket_set_heartbeat(SilcSocketConnection sock, -- 2.24.0