[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: UTIL: refactoring of service.c, includin
From: |
gnunet |
Subject: |
[gnunet] branch master updated: UTIL: refactoring of service.c, including one bugfix of a use-after-free |
Date: |
Wed, 08 May 2024 13:50:25 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new d65ae4ba7 UTIL: refactoring of service.c, including one bugfix of a
use-after-free
d65ae4ba7 is described below
commit d65ae4ba77bb32258b379c6e8d2d8c56ba0636a9
Author: Christian Grothoff <grothoff@gnunet.org>
AuthorDate: Wed May 8 13:50:05 2024 +0200
UTIL: refactoring of service.c, including one bugfix of a use-after-free
---
src/lib/util/service.c | 319 ++++++++++++++++++++-----------------------------
1 file changed, 130 insertions(+), 189 deletions(-)
diff --git a/src/lib/util/service.c b/src/lib/util/service.c
index 7aeabf687..063519f1f 100644
--- a/src/lib/util/service.c
+++ b/src/lib/util/service.c
@@ -24,7 +24,6 @@
* @author Christian Grothoff
* @author Florian Dold
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
@@ -358,10 +357,11 @@ struct GNUNET_SERVICE_Client
* @param sh service to check clients for
* @return #GNUNET_YES if we have non-monitoring clients left
*/
-static int
+static enum GNUNET_GenericReturnValue
have_non_monitor_clients (struct GNUNET_SERVICE_Handle *sh)
{
- for (struct GNUNET_SERVICE_Client *client = sh->clients_head; NULL != client;
+ for (struct GNUNET_SERVICE_Client *client = sh->clients_head;
+ NULL != client;
client = client->next)
{
if (client->is_monitor)
@@ -380,13 +380,14 @@ have_non_monitor_clients (struct GNUNET_SERVICE_Handle
*sh)
* @param sr reason for suspending accepting connections
*/
static void
-do_suspend (struct GNUNET_SERVICE_Handle *sh, enum SuspendReason sr)
+do_suspend (struct GNUNET_SERVICE_Handle *sh,
+ enum SuspendReason sr)
{
- struct ServiceListenContext *slc;
-
GNUNET_assert (0 == (sh->suspend_state & sr));
sh->suspend_state |= sr;
- for (slc = sh->slc_head; NULL != slc; slc = slc->next)
+ for (struct ServiceListenContext *slc = sh->slc_head;
+ NULL != slc;
+ slc = slc->next)
{
if (NULL != slc->listen_task)
{
@@ -435,25 +436,25 @@ service_shutdown (void *cls)
*
* @param list a list of networks
* @param add the IP to check (in network byte order)
- * @return #GNUNET_NO if the IP is not in the list, #GNUNET_YES if it it is
+ * @return false if the IP is not in the list, true if it it is
*/
-static int
+static bool
check_ipv4_listed (const struct GNUNET_STRINGS_IPv4NetworkPolicy *list,
const struct in_addr *add)
{
unsigned int i;
if (NULL == list)
- return GNUNET_NO;
+ return false;
i = 0;
while ((0 != list[i].network.s_addr) || (0 != list[i].netmask.s_addr))
{
if ((add->s_addr & list[i].netmask.s_addr) ==
(list[i].network.s_addr & list[i].netmask.s_addr))
- return GNUNET_YES;
+ return true;
i++;
}
- return GNUNET_NO;
+ return false;
}
@@ -462,16 +463,16 @@ check_ipv4_listed (const struct
GNUNET_STRINGS_IPv4NetworkPolicy *list,
*
* @param list a list of networks
* @param ip the IP to check (in network byte order)
- * @return #GNUNET_NO if the IP is not in the list, #GNUNET_YES if it it is
+ * @return false if the IP is not in the list, true if it it is
*/
-static int
+static bool
check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list,
const struct in6_addr *ip)
{
unsigned int i;
if (NULL == list)
- return GNUNET_NO;
+ return false;
i = 0;
NEXT:
while (GNUNET_NO == GNUNET_is_zero (&list[i].network))
@@ -483,9 +484,9 @@ NEXT:
i++;
goto NEXT;
}
- return GNUNET_YES;
+ return true;
}
- return GNUNET_NO;
+ return false;
}
@@ -593,7 +594,8 @@ service_mq_send (struct GNUNET_MQ_Handle *mq,
* @param impl_state state specific to the implementation
*/
static void
-service_mq_cancel (struct GNUNET_MQ_Handle *mq, void *impl_state)
+service_mq_cancel (struct GNUNET_MQ_Handle *mq,
+ void *impl_state)
{
struct GNUNET_SERVICE_Client *client = impl_state;
@@ -615,12 +617,14 @@ service_mq_cancel (struct GNUNET_MQ_Handle *mq, void
*impl_state)
* @param error error code
*/
static void
-service_mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
+service_mq_error_handler (void *cls,
+ enum GNUNET_MQ_Error error)
{
struct GNUNET_SERVICE_Client *client = cls;
struct GNUNET_SERVICE_Handle *sh = client->sh;
- if ((GNUNET_MQ_ERROR_NO_MATCH == error) && (GNUNET_NO == sh->require_found))
+ if ( (GNUNET_MQ_ERROR_NO_MATCH == error) &&
+ (GNUNET_NO == sh->require_found) )
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"No handler for message of type %u found\n",
@@ -753,7 +757,9 @@ start_client (struct GNUNET_SERVICE_Handle *sh,
struct GNUNET_SERVICE_Client *client;
client = GNUNET_new (struct GNUNET_SERVICE_Client);
- GNUNET_CONTAINER_DLL_insert (sh->clients_head, sh->clients_tail, client);
+ GNUNET_CONTAINER_DLL_insert (sh->clients_head,
+ sh->clients_tail,
+ client);
client->sh = sh;
client->sock = csock;
client->mq = GNUNET_MQ_queue_for_callbacks (&service_mq_send,
@@ -806,7 +812,8 @@ accept_client (void *cls)
if (EMFILE == errno)
do_suspend (sh, SUSPEND_STATE_EMFILE);
else if (EAGAIN != errno)
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "accept");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+ "accept");
break;
}
switch (sa.ss_family)
@@ -815,18 +822,22 @@ accept_client (void *cls)
GNUNET_assert (addrlen == sizeof(struct sockaddr_in));
v4 = (const struct sockaddr_in *) &sa;
ok = (((NULL == sh->v4_allowed) ||
- (check_ipv4_listed (sh->v4_allowed, &v4->sin_addr))) &&
+ (check_ipv4_listed (sh->v4_allowed,
+ &v4->sin_addr))) &&
((NULL == sh->v4_denied) ||
- (! check_ipv4_listed (sh->v4_denied, &v4->sin_addr))));
+ (! check_ipv4_listed (sh->v4_denied,
+ &v4->sin_addr))));
break;
case AF_INET6:
GNUNET_assert (addrlen == sizeof(struct sockaddr_in6));
v6 = (const struct sockaddr_in6 *) &sa;
ok = (((NULL == sh->v6_allowed) ||
- (check_ipv6_listed (sh->v6_allowed, &v6->sin6_addr))) &&
+ (check_ipv6_listed (sh->v6_allowed,
+ &v6->sin6_addr))) &&
((NULL == sh->v6_denied) ||
- (! check_ipv6_listed (sh->v6_denied, &v6->sin6_addr))));
+ (! check_ipv6_listed (sh->v6_denied,
+ &v6->sin6_addr))));
break;
case AF_UNIX:
@@ -850,7 +861,8 @@ accept_client (void *cls)
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Service accepted incoming connection from %s.\n",
GNUNET_a2s ((const struct sockaddr *) &sa, addrlen));
- start_client (slc->sh, sock);
+ start_client (slc->sh,
+ sock);
}
if (0 != sh->suspend_state)
return;
@@ -870,15 +882,16 @@ accept_client (void *cls)
* or #SUSPEND_STATE_NONE on first startup
*/
static void
-do_resume (struct GNUNET_SERVICE_Handle *sh, enum SuspendReason sr)
+do_resume (struct GNUNET_SERVICE_Handle *sh,
+ enum SuspendReason sr)
{
- struct ServiceListenContext *slc;
-
GNUNET_assert ((SUSPEND_STATE_NONE == sr) || (0 != (sh->suspend_state &
sr)));
sh->suspend_state -= sr;
if (SUSPEND_STATE_NONE != sh->suspend_state)
return;
- for (slc = sh->slc_head; NULL != slc; slc = slc->next)
+ for (struct ServiceListenContext *slc = sh->slc_head;
+ NULL != slc;
+ slc = slc->next)
{
GNUNET_assert (NULL == slc->listen_task);
slc->listen_task =
@@ -928,7 +941,7 @@ service_main (void *cls)
* @return #GNUNET_SYSERR on parse error, #GNUNET_OK on success (including
* no ACL configured)
*/
-static int
+static enum GNUNET_GenericReturnValue
process_acl4 (struct GNUNET_STRINGS_IPv4NetworkPolicy **ret,
struct GNUNET_SERVICE_Handle *sh,
const char *option)
@@ -969,7 +982,7 @@ process_acl4 (struct GNUNET_STRINGS_IPv4NetworkPolicy **ret,
* @return #GNUNET_SYSERR on parse error, #GNUNET_OK on success (including
* no ACL configured)
*/
-static int
+static enum GNUNET_GenericReturnValue
process_acl6 (struct GNUNET_STRINGS_IPv6NetworkPolicy **ret,
struct GNUNET_SERVICE_Handle *sh,
const char *option)
@@ -1457,7 +1470,7 @@ open_listen_socket (const struct sockaddr *server_addr,
* @param sh service context to initialize
* @return #GNUNET_OK if configuration succeeded
*/
-static int
+static enum GNUNET_GenericReturnValue
setup_service (struct GNUNET_SERVICE_Handle *sh)
{
int tolerant;
@@ -1532,7 +1545,9 @@ setup_service (struct GNUNET_SERVICE_Handle *sh)
slc = GNUNET_new (struct ServiceListenContext);
slc->sh = sh;
slc->listen_socket = *ls;
- GNUNET_CONTAINER_DLL_insert (sh->slc_head, sh->slc_tail, slc);
+ GNUNET_CONTAINER_DLL_insert (sh->slc_head,
+ sh->slc_tail,
+ slc);
}
GNUNET_free (lsocks);
}
@@ -1552,7 +1567,8 @@ setup_service (struct GNUNET_SERVICE_Handle *sh)
slc = GNUNET_new (struct ServiceListenContext);
slc->sh = sh;
- slc->listen_socket = open_listen_socket (addrs[i], addrlens[i]);
+ slc->listen_socket = open_listen_socket (addrs[i],
+ addrlens[i]);
GNUNET_free (addrs[i]);
if (NULL == slc->listen_socket)
{
@@ -1609,10 +1625,11 @@ get_user_name (struct GNUNET_SERVICE_Handle *sh)
{
char *un;
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (sh->cfg,
- sh->service_name,
- "USERNAME",
- &un))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_filename (sh->cfg,
+ sh->service_name,
+ "USERNAME",
+ &un))
return NULL;
return un;
}
@@ -1680,10 +1697,11 @@ get_pid_file_name (struct GNUNET_SERVICE_Handle *sh)
{
char *pif;
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (sh->cfg,
- sh->service_name,
- "PIDFILE",
- &pif))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_filename (sh->cfg,
+ sh->service_name,
+ "PIDFILE",
+ &pif))
return NULL;
return pif;
}
@@ -1702,7 +1720,9 @@ pid_file_delete (struct GNUNET_SERVICE_Handle *sh)
if (NULL == pif)
return; /* no PID file */
if (0 != unlink (pif))
- LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "unlink", pif);
+ LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING,
+ "unlink",
+ pif);
GNUNET_free (pif);
}
@@ -1713,7 +1733,7 @@ pid_file_delete (struct GNUNET_SERVICE_Handle *sh)
* @param sh service context
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
-static int
+static enum GNUNET_GenericReturnValue
detach_terminal (struct GNUNET_SERVICE_Handle *sh)
{
pid_t pid;
@@ -1821,7 +1841,8 @@ teardown_service (struct GNUNET_SERVICE_Handle *sh)
* @param msg AGPL request
*/
static void
-return_agpl (void *cls, const struct GNUNET_MessageHeader *msg)
+return_agpl (void *cls,
+ const struct GNUNET_MessageHeader *msg)
{
struct GNUNET_SERVICE_Client *client = cls;
struct GNUNET_MQ_Handle *mq;
@@ -1840,42 +1861,6 @@ return_agpl (void *cls, const struct
GNUNET_MessageHeader *msg)
}
-/**
- * Low-level function to start a service if the scheduler
- * is already running. Should only be used directly in
- * special cases.
- *
- * The function will launch the service with the name @a service_name
- * using the @a service_options to configure its shutdown
- * behavior. When clients connect or disconnect, the respective
- * @a connect_cb or @a disconnect_cb functions will be called. For
- * messages received from the clients, the respective @a handlers will
- * be invoked; for the closure of the handlers we use the return value
- * from the @a connect_cb invocation of the respective client.
- *
- * Each handler MUST call #GNUNET_SERVICE_client_continue() after each
- * message to receive further messages from this client. If
- * #GNUNET_SERVICE_client_continue() is not called within a short
- * time, a warning will be logged. If delays are expected, services
- * should call #GNUNET_SERVICE_client_disable_continue_warning() to
- * disable the warning.
- *
- * Clients sending invalid messages (based on @a handlers) will be
- * dropped. Additionally, clients can be dropped at any time using
- * #GNUNET_SERVICE_client_drop().
- *
- * The service must be stopped using #GNUNET_SERVICE_stop().
- *
- * @param service_name name of the service to run
- * @param cfg configuration to use
- * @param connect_cb function to call whenever a client connects
- * @param disconnect_cb function to call whenever a client disconnects
- * @param cls closure argument for @a connect_cb and @a disconnect_cb
- * @param handlers NULL-terminated array of message handlers for the service,
- * the closure will be set to the value returned by
- * the @a connect_cb for the respective connection
- * @return NULL on error
- */
struct GNUNET_SERVICE_Handle *
GNUNET_SERVICE_start (const char *service_name,
const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -1892,23 +1877,21 @@ GNUNET_SERVICE_start (const char *service_name,
sh->connect_cb = connect_cb;
sh->disconnect_cb = disconnect_cb;
sh->cb_cls = cls;
- sh->handlers = GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL);
+ sh->handlers = GNUNET_MQ_copy_handlers2 (handlers,
+ &return_agpl,
+ NULL);
if (GNUNET_OK != setup_service (sh))
{
GNUNET_free (sh->handlers);
GNUNET_free (sh);
return NULL;
}
- do_resume (sh, SUSPEND_STATE_NONE);
+ do_resume (sh,
+ SUSPEND_STATE_NONE);
return sh;
}
-/**
- * Stops a service that was started with #GNUNET_SERVICE_start().
- *
- * @param srv service to stop
- */
void
GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv)
{
@@ -2073,14 +2056,16 @@ GNUNET_SERVICE_run_ (int argc,
"Service `%s' runs with configuration from `%s'\n",
service_name,
(NULL != opt_cfg_filename) ? opt_cfg_filename : cfg_filename);
- if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (sh.cfg,
- "TESTING",
- "SKEW_OFFSET",
- &skew_offset)) &&
- (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (sh.cfg,
- "TESTING",
- "SKEW_VARIANCE",
- &skew_variance)))
+ if ( (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_number (sh.cfg,
+ "TESTING",
+ "SKEW_OFFSET",
+ &skew_offset)) &&
+ (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_number (sh.cfg,
+ "TESTING",
+ "SKEW_VARIANCE",
+ &skew_variance)) )
{
clock_offset = skew_offset - skew_variance;
GNUNET_TIME_set_offset (clock_offset);
@@ -2119,7 +2104,10 @@ shutdown:
struct mallinfo2 mi;
mi = mallinfo2 ();
- GAUGER (service_name, counter, mi.usmblks, "blocks");
+ GAUGER (service_name,
+ counter,
+ mi.usmblks,
+ "blocks");
GNUNET_free (counter);
}
}
@@ -2153,10 +2141,10 @@ struct ServiceHandleList
};
/* The service list */
-static struct ServiceHandleList *hll_head = NULL;
+static struct ServiceHandleList *hll_head;
/* The service list */
-static struct ServiceHandleList *hll_tail = NULL;
+static struct ServiceHandleList *hll_tail;
int
GNUNET_SERVICE_register_ (const char *service_name,
@@ -2184,7 +2172,9 @@ GNUNET_SERVICE_register_ (const char *service_name,
sh->ret = 0;
hle = GNUNET_new (struct ServiceHandleList);
hle->sh = sh;
- GNUNET_CONTAINER_DLL_insert (hll_head, hll_tail, hle);
+ GNUNET_CONTAINER_DLL_insert (hll_head,
+ hll_tail,
+ hle);
return GNUNET_OK;
}
@@ -2192,19 +2182,22 @@ GNUNET_SERVICE_register_ (const char *service_name,
static void
do_registered_services_shutdown (void *cls)
{
- struct GNUNET_SERVICE_Handle *sh;
- struct ServiceHandleList *shl;
-
- for (shl = hll_head; NULL != shl;)
+ while (NULL != hll_head)
{
- sh = shl->sh;
- GNUNET_CONTAINER_DLL_remove (hll_head, hll_tail, shl);
+ struct ServiceHandleList *shl = hll_head;
+ struct GNUNET_SERVICE_Handle *sh = shl->sh;
+
+ GNUNET_CONTAINER_DLL_remove (hll_head,
+ hll_tail,
+ shl);
GNUNET_free (shl);
if (-1 != sh->ready_confirm_fd)
{
if (1 != write (sh->ready_confirm_fd, "S", 1))
- LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "write");
- GNUNET_break (0 == close (sh->ready_confirm_fd));
+ LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING,
+ "write");
+ GNUNET_break (0 ==
+ close (sh->ready_confirm_fd));
}
teardown_service (sh);
GNUNET_free (sh->handlers);
@@ -2216,20 +2209,22 @@ do_registered_services_shutdown (void *cls)
static void
launch_registered_services (void *cls)
{
- struct ServiceHandleList *shl;
struct GNUNET_CONFIGURATION_Handle *cfg = cls;
- for (shl = hll_head; NULL != shl; shl = shl->next)
+ for (struct ServiceHandleList *shl = hll_head;
+ NULL != shl;
+ shl = shl->next)
{
shl->sh->cfg = cfg;
if (GNUNET_OK != setup_service (shl->sh))
continue;
if (GNUNET_OK != set_user_id (shl->sh))
continue;
-
- GNUNET_SCHEDULER_add_now (&service_main, shl->sh);
+ GNUNET_SCHEDULER_add_now (&service_main,
+ shl->sh);
}
- GNUNET_SCHEDULER_add_shutdown (&do_registered_services_shutdown, NULL);
+ GNUNET_SCHEDULER_add_shutdown (&do_registered_services_shutdown,
+ NULL);
}
@@ -2291,8 +2286,11 @@ GNUNET_SERVICE_main (int argc,
}
if (NULL != opt_cfg_filename)
{
- if ((GNUNET_YES != GNUNET_DISK_file_test (opt_cfg_filename)) ||
- (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, opt_cfg_filename)))
+ if ( (GNUNET_YES !=
+ GNUNET_DISK_file_test (opt_cfg_filename)) ||
+ (GNUNET_SYSERR ==
+ GNUNET_CONFIGURATION_load (cfg,
+ opt_cfg_filename)) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_ ("Malformed configuration file `%s', exit ...\n"),
@@ -2302,9 +2300,12 @@ GNUNET_SERVICE_main (int argc,
}
else
{
- if (GNUNET_YES == GNUNET_DISK_file_test (cfg_filename))
+ if (GNUNET_YES ==
+ GNUNET_DISK_file_test (cfg_filename))
{
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cfg_filename))
+ if (GNUNET_SYSERR ==
+ GNUNET_CONFIGURATION_load (cfg,
+ cfg_filename))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_ ("Malformed configuration file `%s', exit ...\n"),
@@ -2326,7 +2327,8 @@ GNUNET_SERVICE_main (int argc,
}
GNUNET_RESOLVER_connect (cfg);
- GNUNET_SCHEDULER_run (&launch_registered_services, cfg);
+ GNUNET_SCHEDULER_run (&launch_registered_services,
+ cfg);
shutdown:
GNUNET_SPEEDUP_stop_ ();
GNUNET_CONFIGURATION_destroy (cfg);
@@ -2337,28 +2339,19 @@ shutdown:
}
-/**
- * Suspend accepting connections from the listen socket temporarily.
- * Resume activity using #GNUNET_SERVICE_resume.
- *
- * @param sh service to stop accepting connections.
- */
void
GNUNET_SERVICE_suspend (struct GNUNET_SERVICE_Handle *sh)
{
- do_suspend (sh, SUSPEND_STATE_APP);
+ do_suspend (sh,
+ SUSPEND_STATE_APP);
}
-/**
- * Resume accepting connections from the listen socket.
- *
- * @param sh service to resume accepting connections.
- */
void
GNUNET_SERVICE_resume (struct GNUNET_SERVICE_Handle *sh)
{
- do_resume (sh, SUSPEND_STATE_APP);
+ do_resume (sh,
+ SUSPEND_STATE_APP);
}
@@ -2398,12 +2391,6 @@ resume_client_receive (void *cls)
}
-/**
- * Continue receiving further messages from the given client.
- * Must be called after each message received.
- *
- * @param c the client to continue receiving from
- */
void
GNUNET_SERVICE_client_continue (struct GNUNET_SERVICE_Client *c)
{
@@ -2416,18 +2403,11 @@ GNUNET_SERVICE_client_continue (struct
GNUNET_SERVICE_Client *c)
GNUNET_SCHEDULER_cancel (c->warn_task);
c->warn_task = NULL;
}
- c->recv_task = GNUNET_SCHEDULER_add_now (&resume_client_receive, c);
+ c->recv_task = GNUNET_SCHEDULER_add_now (&resume_client_receive,
+ c);
}
-/**
- * Disable the warning the server issues if a message is not
- * acknowledged in a timely fashion. Use this call if a client is
- * intentionally delayed for a while. Only applies to the current
- * message.
- *
- * @param c client for which to disable the warning
- */
void
GNUNET_SERVICE_client_disable_continue_warning (struct GNUNET_SERVICE_Client
*c)
{
@@ -2475,16 +2455,6 @@ finish_client_drop (void *cls)
}
-/**
- * Ask the server to disconnect from the given client. This is the
- * same as returning #GNUNET_SYSERR within the check procedure when
- * handling a message, wexcept that it allows dropping of a client even
- * when not handling a message from that client. The `disconnect_cb`
- * will be called on @a c even if the application closes the connection
- * using this function.
- *
- * @param c client to disconnect now
- */
void
GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c)
{
@@ -2535,15 +2505,11 @@ GNUNET_SERVICE_client_drop (struct
GNUNET_SERVICE_Client *c)
GNUNET_SCHEDULER_cancel (c->send_task);
c->send_task = NULL;
}
- c->drop_task = GNUNET_SCHEDULER_add_now (&finish_client_drop, c);
+ c->drop_task = GNUNET_SCHEDULER_add_now (&finish_client_drop,
+ c);
}
-/**
- * Explicitly stops the service.
- *
- * @param sh server to shutdown
- */
void
GNUNET_SERVICE_shutdown (struct GNUNET_SERVICE_Handle *sh)
{
@@ -2556,18 +2522,6 @@ GNUNET_SERVICE_shutdown (struct GNUNET_SERVICE_Handle
*sh)
}
-/**
- * Set the 'monitor' flag on this client. Clients which have been
- * marked as 'monitors' won't prevent the server from shutting down
- * once #GNUNET_SERVICE_stop_listening() has been invoked. The idea is
- * that for "normal" clients we likely want to allow them to process
- * their requests; however, monitor-clients are likely to 'never'
- * disconnect during shutdown and thus will not be considered when
- * determining if the server should continue to exist after
- * shutdown has been triggered.
- *
- * @param c client to mark as a monitor
- */
void
GNUNET_SERVICE_client_mark_monitor (struct GNUNET_SERVICE_Client *c)
{
@@ -2578,13 +2532,6 @@ GNUNET_SERVICE_client_mark_monitor (struct
GNUNET_SERVICE_Client *c)
}
-/**
- * Set the persist option on this client. Indicates that the
- * underlying socket or fd should never really be closed. Used for
- * indicating process death.
- *
- * @param c client to persist the socket (never to be closed)
- */
void
GNUNET_SERVICE_client_persist (struct GNUNET_SERVICE_Client *c)
{
@@ -2592,12 +2539,6 @@ GNUNET_SERVICE_client_persist (struct
GNUNET_SERVICE_Client *c)
}
-/**
- * Obtain the message queue of @a c. Convenience function.
- *
- * @param c the client to continue receiving from
- * @return the message queue of @a c
- */
struct GNUNET_MQ_Handle *
GNUNET_SERVICE_client_get_mq (struct GNUNET_SERVICE_Client *c)
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: UTIL: refactoring of service.c, including one bugfix of a use-after-free,
gnunet <=