Heartbeat context is not freed automatically by the library
authorPekka Riikonen <priikone@silcnet.org>
Mon, 16 Sep 2002 15:39:00 +0000 (15:39 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 16 Sep 2002 15:39:00 +0000 (15:39 +0000)
anymore.

CHANGES
apps/silcd/server.c
lib/silcutil/silcsockconn.c
lib/silcutil/silcsockconn.h

diff --git a/CHANGES b/CHANGES
index e0861f008d37ab6d0a97595080a34d23412b26c9..2d2a9e4126e5de83c70f8ab4c37d65f5cad15e1d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,11 @@ Mon Sep 16 12:02:54 EEST 2002  Pekka Riikonen <priikone@silcnet.org>
          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 <priikone@silcnet.org>
 
        * Added support for removing explicitly added client connections
index d75fdd803526407382be26878b938fb64ef393cf..c2d60f9674868e77760b0462c17dd0412169988a 100644 (file)
@@ -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,
index c32aaf8cc571b3fdf11959fabc086fa4078c93a3..25a56fe1aa658de5398f2502063c1da450cea65a 100644 (file)
@@ -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);
   }
 
index a78f393970907cfdc63f7dc1a3a4f3454da50aa0..6507e269f913833ee3a8ba88d7a68662f017ad0c 100644 (file)
@@ -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,