aboutsummaryrefslogtreecommitdiff
path: root/src/util/service.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/service.c')
-rw-r--r--src/util/service.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/util/service.c b/src/util/service.c
index 1156093f4..ae1809950 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -1572,6 +1572,36 @@ teardown_service (struct GNUNET_SERVICE_Handle *sh)
1572 1572
1573 1573
1574/** 1574/**
1575 * Function to return link to AGPL source upon request.
1576 *
1577 * @param cls closure with the identification of the client
1578 * @param msg AGPL request
1579 */
1580static void
1581return_agpl (void *cls,
1582 const struct GNUNET_MessageHeader *msg)
1583{
1584 struct GNUNET_SERVICE_Client *client = cls;
1585 struct GNUNET_MQ_Handle *mq;
1586 struct GNUNET_MQ_Envelope *env;
1587 struct GNUNET_MessageHeader *res;
1588 size_t slen;
1589
1590 slen = strlen (GNUNET_AGPL_URL) + 1;
1591 env = GNUNET_MQ_msg_extra (res,
1592 GNUNET_MESSAGE_TYPE_RESPONSE_AGPL,
1593 slen);
1594 memcpy (&res[1],
1595 GNUNET_AGPL_URL,
1596 slen);
1597 mq = GNUNET_SERVICE_client_get_mq (client);
1598 GNUNET_MQ_send (mq,
1599 env);
1600 GNUNET_SERVICE_client_continue (client);
1601}
1602
1603
1604/**
1575 * Low-level function to start a service if the scheduler 1605 * Low-level function to start a service if the scheduler
1576 * is already running. Should only be used directly in 1606 * is already running. Should only be used directly in
1577 * special cases. 1607 * special cases.
@@ -1623,7 +1653,9 @@ GNUNET_SERVICE_start (const char *service_name,
1623 sh->connect_cb = connect_cb; 1653 sh->connect_cb = connect_cb;
1624 sh->disconnect_cb = disconnect_cb; 1654 sh->disconnect_cb = disconnect_cb;
1625 sh->cb_cls = cls; 1655 sh->cb_cls = cls;
1626 sh->handlers = GNUNET_MQ_copy_handlers (handlers); 1656 sh->handlers = GNUNET_MQ_copy_handlers2 (handlers,
1657 &return_agpl,
1658 NULL);
1627 if (GNUNET_OK != setup_service (sh)) 1659 if (GNUNET_OK != setup_service (sh))
1628 { 1660 {
1629 GNUNET_free_non_null (sh->handlers); 1661 GNUNET_free_non_null (sh->handlers);
@@ -1723,9 +1755,9 @@ GNUNET_SERVICE_run_ (int argc,
1723 struct GNUNET_GETOPT_CommandLineOption service_options[] = { 1755 struct GNUNET_GETOPT_CommandLineOption service_options[] = {
1724 GNUNET_GETOPT_option_cfgfile (&opt_cfg_filename), 1756 GNUNET_GETOPT_option_cfgfile (&opt_cfg_filename),
1725 GNUNET_GETOPT_option_flag ('d', 1757 GNUNET_GETOPT_option_flag ('d',
1726 "daemonize", 1758 "daemonize",
1727 gettext_noop ("do daemonize (detach from terminal)"), 1759 gettext_noop ("do daemonize (detach from terminal)"),
1728 &do_daemonize), 1760 &do_daemonize),
1729 GNUNET_GETOPT_option_help (NULL), 1761 GNUNET_GETOPT_option_help (NULL),
1730 GNUNET_GETOPT_option_loglevel (&loglev), 1762 GNUNET_GETOPT_option_loglevel (&loglev),
1731 GNUNET_GETOPT_option_logfile (&logfile), 1763 GNUNET_GETOPT_option_logfile (&logfile),