gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated (fa0907738 -> 9388822eb)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (fa0907738 -> 9388822eb)
Date: Fri, 27 Sep 2019 23:26:41 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository gnunet.

    from fa0907738 print service summary
     new eadf4b737 indent
     new c8ed84e48 implementing GNUNET_CLIENT_test() to check for service 
operating
     new 9388822eb do not attempt name resolution or terminating a peer in 
gnunet-arm if the peer is not running

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/arm/arm_api.c               |  820 ++++++++-------
 src/arm/gnunet-arm.c            | 1044 ++++++++++---------
 src/gns/gnunet-gns.c            |  266 ++---
 src/include/gnunet_client_lib.h |   27 +-
 src/util/client.c               | 1000 ++++++++++--------
 src/util/service.c              | 2152 +++++++++++++++++++--------------------
 6 files changed, 2828 insertions(+), 2481 deletions(-)

diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index 4c3bb0488..dc5c9c25b 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2012, 2013, 2016 GNUnet e.V.
+     Copyright (C) 2009, 2010, 2012, 2013, 2016, 2019 GNUnet e.V.
 
      GNUnet is free software: you can redistribute it and/or modify it
      under the terms of the GNU Affero General Public License as published
@@ -30,14 +30,15 @@
 #include "gnunet_protocols.h"
 #include "arm.h"
 
-#define LOG(kind, ...) GNUNET_log_from(kind, "arm-api", __VA_ARGS__)
+#define LOG(kind, ...) GNUNET_log_from (kind, "arm-api", __VA_ARGS__)
 
 
 /**
  * Entry in a doubly-linked list of operations awaiting for replies
  * (in-order) from the ARM service.
  */
-struct GNUNET_ARM_Operation {
+struct GNUNET_ARM_Operation
+{
   /**
    * This is a doubly-linked list.
    */
@@ -93,7 +94,8 @@ struct GNUNET_ARM_Operation {
 /**
  * Handle for interacting with ARM.
  */
-struct GNUNET_ARM_Handle {
+struct GNUNET_ARM_Handle
+{
   /**
    * Our connection to the ARM service.
    */
@@ -164,7 +166,7 @@ struct GNUNET_ARM_Handle {
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
  */
 static int
-reconnect_arm(struct GNUNET_ARM_Handle *h);
+reconnect_arm (struct GNUNET_ARM_Handle *h);
 
 
 /**
@@ -173,12 +175,12 @@ reconnect_arm(struct GNUNET_ARM_Handle *h);
  * @param cls the `struct GNUNET_ARM_Handle`
  */
 static void
-reconnect_arm_task(void *cls)
+reconnect_arm_task (void *cls)
 {
   struct GNUNET_ARM_Handle *h = cls;
 
   h->reconnect_task = NULL;
-  reconnect_arm(h);
+  reconnect_arm (h);
 }
 
 
@@ -189,31 +191,31 @@ reconnect_arm_task(void *cls)
  * @param h our handle
  */
 static void
-reconnect_arm_later(struct GNUNET_ARM_Handle *h)
+reconnect_arm_later (struct GNUNET_ARM_Handle *h)
 {
   struct GNUNET_ARM_Operation *op;
 
   if (NULL != h->mq)
-    {
-      GNUNET_MQ_destroy(h->mq);
-      h->mq = NULL;
-    }
+  {
+    GNUNET_MQ_destroy (h->mq);
+    h->mq = NULL;
+  }
   h->currently_up = GNUNET_NO;
-  GNUNET_assert(NULL == h->reconnect_task);
+  GNUNET_assert (NULL == h->reconnect_task);
   h->reconnect_task =
-    GNUNET_SCHEDULER_add_delayed(h->retry_backoff, &reconnect_arm_task, h);
+    GNUNET_SCHEDULER_add_delayed (h->retry_backoff, &reconnect_arm_task, h);
   while (NULL != (op = h->operation_pending_head))
-    {
-      if (NULL != op->result_cont)
-        op->result_cont(op->cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, 0);
-      if (NULL != op->list_cont)
-        op->list_cont(op->cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, 0, NULL);
-      GNUNET_ARM_operation_cancel(op);
-    }
-  GNUNET_assert(NULL == h->operation_pending_head);
-  h->retry_backoff = GNUNET_TIME_STD_BACKOFF(h->retry_backoff);
+  {
+    if (NULL != op->result_cont)
+      op->result_cont (op->cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, 0);
+    if (NULL != op->list_cont)
+      op->list_cont (op->cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, 0, NULL);
+    GNUNET_ARM_operation_cancel (op);
+  }
+  GNUNET_assert (NULL == h->operation_pending_head);
+  h->retry_backoff = GNUNET_TIME_STD_BACKOFF (h->retry_backoff);
   if (NULL != h->conn_status)
-    h->conn_status(h->conn_status_cls, GNUNET_NO);
+    h->conn_status (h->conn_status_cls, GNUNET_NO);
 }
 
 
@@ -225,11 +227,11 @@ reconnect_arm_later(struct GNUNET_ARM_Handle *h)
  * @return NULL if not found
  */
 static struct GNUNET_ARM_Operation *
-find_op_by_id(struct GNUNET_ARM_Handle *h, uint64_t id)
+find_op_by_id (struct GNUNET_ARM_Handle *h,
+               uint64_t id)
 {
-  struct GNUNET_ARM_Operation *result;
-
-  for (result = h->operation_pending_head; NULL != result;
+  for (struct GNUNET_ARM_Operation *result = h->operation_pending_head;
+       NULL != result;
        result = result->next)
     if (id == result->id)
       return result;
@@ -244,7 +246,8 @@ find_op_by_id(struct GNUNET_ARM_Handle *h, uint64_t id)
  * @param res the message received from the arm service
  */
 static void
-handle_arm_result(void *cls, const struct GNUNET_ARM_ResultMessage *res)
+handle_arm_result (void *cls,
+                   const struct GNUNET_ARM_ResultMessage *res)
 {
   struct GNUNET_ARM_Handle *h = cls;
   struct GNUNET_ARM_Operation *op;
@@ -253,43 +256,46 @@ handle_arm_result(void *cls, const struct 
GNUNET_ARM_ResultMessage *res)
   GNUNET_ARM_ResultCallback result_cont;
   void *result_cont_cls;
 
-  id = GNUNET_ntohll(res->arm_msg.request_id);
-  op = find_op_by_id(h, id);
+  id = GNUNET_ntohll (res->arm_msg.request_id);
+  op = find_op_by_id (h, id);
   if (NULL == op)
-    {
-      LOG(GNUNET_ERROR_TYPE_DEBUG,
-          "Message with unknown id %llu\n",
-          (unsigned long long)id);
-      return;
-    }
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Message with unknown id %llu\n",
+         (unsigned long long) id);
+    return;
+  }
 
-  result = (enum GNUNET_ARM_Result)ntohl(res->result);
-  if ((GNUNET_YES == op->is_arm_stop) && (GNUNET_ARM_RESULT_STOPPING == 
result))
+  result = (enum GNUNET_ARM_Result) ntohl (res->result);
+  if ( (GNUNET_YES == op->is_arm_stop) &&
+       (GNUNET_ARM_RESULT_STOPPING == result) )
+  {
+    /* special case: if we are stopping 'gnunet-service-arm', we do not just
+       wait for the result message, but also wait for the service to close
+       the connection (and then we have to close our client handle as well);
+       this is done by installing a different receive handler, waiting for
+       the connection to go down */
+    if (NULL != h->thm)
     {
-      /* special case: if we are stopping 'gnunet-service-arm', we do not just
-         wait for the result message, but also wait for the service to close
-         the connection (and then we have to close our client handle as well);
-         this is done by installing a different receive handler, waiting for
-         the connection to go down */
-      if (NULL != h->thm)
-        {
-          GNUNET_break(0);
-          op->result_cont(h->thm->cont_cls,
-                          GNUNET_ARM_REQUEST_SENT_OK,
-                          GNUNET_ARM_RESULT_IS_NOT_KNOWN);
-          GNUNET_free(h->thm);
-        }
-      GNUNET_CONTAINER_DLL_remove(h->operation_pending_head,
-                                  h->operation_pending_tail,
-                                  op);
-      h->thm = op;
-      return;
+      GNUNET_break (0);
+      op->result_cont (h->thm->cont_cls,
+                       GNUNET_ARM_REQUEST_SENT_OK,
+                       GNUNET_ARM_RESULT_IS_NOT_KNOWN);
+      GNUNET_free (h->thm);
     }
+    GNUNET_CONTAINER_DLL_remove (h->operation_pending_head,
+                                 h->operation_pending_tail,
+                                 op);
+    h->thm = op;
+    return;
+  }
   result_cont = op->result_cont;
   result_cont_cls = op->cont_cls;
-  GNUNET_ARM_operation_cancel(op);
+  GNUNET_ARM_operation_cancel (op);
   if (NULL != result_cont)
-    result_cont(result_cont_cls, GNUNET_ARM_REQUEST_SENT_OK, result);
+    result_cont (result_cont_cls,
+                 GNUNET_ARM_REQUEST_SENT_OK,
+                 result);
 }
 
 
@@ -303,7 +309,9 @@ handle_arm_result(void *cls, const struct 
GNUNET_ARM_ResultMessage *res)
  *          NULL if the index is out of bounds
  */
 static const char *
-pool_get (const char *pool_start, size_t pool_size, size_t str_index)
+pool_get (const char *pool_start,
+          size_t pool_size,
+          size_t str_index)
 {
   const char *str_start;
   const char *end;
@@ -311,7 +319,7 @@ pool_get (const char *pool_start, size_t pool_size, size_t 
str_index)
   if (str_index >= pool_size)
     return NULL;
   str_start = pool_start + str_index;
-  end = memchr(str_start, 0, pool_size - str_index);
+  end = memchr (str_start, 0, pool_size - str_index);
   if (NULL == end)
     return NULL;
   return str_start;
@@ -326,42 +334,42 @@ pool_get (const char *pool_start, size_t pool_size, 
size_t str_index)
  * @return #GNUNET_OK if message is well-formed
  */
 static int
-check_arm_list_result(void *cls,
-                      const struct GNUNET_ARM_ListResultMessage *lres)
+check_arm_list_result (void *cls,
+                       const struct GNUNET_ARM_ListResultMessage *lres)
 {
-  uint16_t rcount = ntohs(lres->count);
-  uint16_t msize = ntohs(lres->arm_msg.header.size) - sizeof(*lres);
+  uint16_t rcount = ntohs (lres->count);
+  uint16_t msize = ntohs (lres->arm_msg.header.size) - sizeof(*lres);
   struct GNUNET_ARM_ServiceInfoMessage *ssm;
   size_t pool_size;
   char *pool_start;
 
+  (void) cls;
   if ((rcount * sizeof (struct GNUNET_ARM_ServiceInfoMessage) > msize))
   {
     GNUNET_break_op (0);
     return GNUNET_NO;
   }
-
   ssm = (struct GNUNET_ARM_ServiceInfoMessage *) &lres[1];
   pool_start = (char *) (ssm + rcount);
   pool_size = msize - (rcount * sizeof (struct GNUNET_ARM_ServiceInfoMessage));
-
-  (void)cls;
   for (unsigned int i = 0; i < rcount; i++)
+  {
+    uint16_t name_index = ntohs (ssm->name_index);
+    uint16_t binary_index = ntohs (ssm->binary_index);
+    if (NULL == pool_get (pool_start, pool_size, name_index))
     {
-      uint16_t name_index = ntohs (ssm->name_index);
-      uint16_t binary_index = ntohs (ssm->binary_index);
-      if (NULL == pool_get (pool_start, pool_size, name_index))
-      {
-        GNUNET_break_op (0);
-        return GNUNET_NO;
-      }
-      if (NULL == pool_get (pool_start, pool_size, binary_index))
-      {
-        GNUNET_break_op (0);
-        return GNUNET_NO;
-      }
-      ssm++;
+      GNUNET_break_op (0);
+      return GNUNET_NO;
     }
+    if (NULL == pool_get (pool_start,
+                          pool_size,
+                          binary_index))
+    {
+      GNUNET_break_op (0);
+      return GNUNET_NO;
+    }
+    ssm++;
+  }
   return GNUNET_OK;
 }
 
@@ -373,12 +381,12 @@ check_arm_list_result(void *cls,
  * @param lres the message received from the arm service
  */
 static void
-handle_arm_list_result(void *cls,
-                       const struct GNUNET_ARM_ListResultMessage *lres)
+handle_arm_list_result (void *cls,
+                        const struct GNUNET_ARM_ListResultMessage *lres)
 {
   struct GNUNET_ARM_Handle *h = cls;
-  uint16_t rcount = ntohs(lres->count);
-  uint16_t msize = ntohs(lres->arm_msg.header.size) - sizeof(*lres);
+  uint16_t rcount = ntohs (lres->count);
+  uint16_t msize = ntohs (lres->arm_msg.header.size) - sizeof(*lres);
   struct GNUNET_ARM_ServiceInfo list[rcount];
   struct GNUNET_ARM_ServiceInfoMessage *ssm;
   struct GNUNET_ARM_Operation *op;
@@ -386,44 +394,50 @@ handle_arm_list_result(void *cls,
   size_t pool_size;
   char *pool_start;
 
-  id = GNUNET_ntohll(lres->arm_msg.request_id);
-  op = find_op_by_id(h, id);
+  id = GNUNET_ntohll (lres->arm_msg.request_id);
+  op = find_op_by_id (h, id);
   if (NULL == op)
-    {
-      LOG(GNUNET_ERROR_TYPE_DEBUG,
-          "Message with unknown id %llu\n",
-          (unsigned long long)id);
-      return;
-    }
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Message with unknown id %llu\n",
+         (unsigned long long) id);
+    return;
+  }
 
-  GNUNET_assert ((rcount * sizeof (struct GNUNET_ARM_ServiceInfoMessage) <= 
msize));
+  GNUNET_assert ((rcount * sizeof (struct GNUNET_ARM_ServiceInfoMessage) <=
+                  msize));
 
   ssm = (struct GNUNET_ARM_ServiceInfoMessage *) &lres[1];
   pool_start = (char *) (ssm + rcount);
   pool_size = msize - (rcount * sizeof (struct GNUNET_ARM_ServiceInfoMessage));
 
   for (unsigned int i = 0; i < rcount; i++)
-    {
-      uint16_t name_index = ntohs (ssm->name_index);
-      uint16_t binary_index = ntohs (ssm->binary_index);
-      const char *name;
-      const char *binary;
-
-      GNUNET_assert (NULL != (name = pool_get (pool_start, pool_size, 
name_index)));
-      GNUNET_assert (NULL != (binary = pool_get (pool_start, pool_size, 
binary_index)));
-      list[i] = (struct GNUNET_ARM_ServiceInfo) {
-        .name = name,
-        .binary = binary,
-        .status = ntohl (ssm->status),
-        .last_started_at = GNUNET_TIME_absolute_ntoh (ssm->last_started_at),
-        .restart_at = GNUNET_TIME_absolute_ntoh (ssm->restart_at),
-        .last_exit_status = ntohs (ssm->last_exit_status),
-      };
-      ssm++;
-    }
+  {
+    uint16_t name_index = ntohs (ssm->name_index);
+    uint16_t binary_index = ntohs (ssm->binary_index);
+    const char *name;
+    const char *binary;
+
+    GNUNET_assert (NULL != (name = pool_get (pool_start, pool_size,
+                                             name_index)));
+    GNUNET_assert (NULL != (binary = pool_get (pool_start, pool_size,
+                                               binary_index)));
+    list[i] = (struct GNUNET_ARM_ServiceInfo) {
+      .name = name,
+      .binary = binary,
+      .status = ntohl (ssm->status),
+      .last_started_at = GNUNET_TIME_absolute_ntoh (ssm->last_started_at),
+      .restart_at = GNUNET_TIME_absolute_ntoh (ssm->restart_at),
+      .last_exit_status = ntohs (ssm->last_exit_status),
+    };
+    ssm++;
+  }
   if (NULL != op->list_cont)
-    op->list_cont(op->cont_cls, GNUNET_ARM_REQUEST_SENT_OK, rcount, list);
-  GNUNET_ARM_operation_cancel(op);
+    op->list_cont (op->cont_cls,
+                   GNUNET_ARM_REQUEST_SENT_OK,
+                   rcount,
+                   list);
+  GNUNET_ARM_operation_cancel (op);
 }
 
 
@@ -434,18 +448,20 @@ handle_arm_list_result(void *cls,
  * @param msg message received
  */
 static void
-handle_confirm(void *cls, const struct GNUNET_MessageHeader *msg)
+handle_confirm (void *cls,
+                const struct GNUNET_MessageHeader *msg)
 {
   struct GNUNET_ARM_Handle *h = cls;
 
-  (void)msg;
-  LOG(GNUNET_ERROR_TYPE_DEBUG, "Got confirmation from ARM that we are up!\n");
+  (void) msg;
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Got confirmation from ARM that we are up!\n");
   if (GNUNET_NO == h->currently_up)
-    {
-      h->currently_up = GNUNET_YES;
-      if (NULL != h->conn_status)
-        h->conn_status(h->conn_status_cls, GNUNET_YES);
-    }
+  {
+    h->currently_up = GNUNET_YES;
+    if (NULL != h->conn_status)
+      h->conn_status (h->conn_status_cls, GNUNET_YES);
+  }
 }
 
 
@@ -458,22 +474,23 @@ handle_confirm(void *cls, const struct 
GNUNET_MessageHeader *msg)
  * @param error error code
  */
 static void
-mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
+mq_error_handler (void *cls,
+                  enum GNUNET_MQ_Error error)
 {
   struct GNUNET_ARM_Handle *h = cls;
   struct GNUNET_ARM_Operation *op;
 
-  (void)error;
+  (void) error;
   h->currently_up = GNUNET_NO;
   if (NULL != (op = h->thm))
-    {
-      h->thm = NULL;
-      op->result_cont(op->cont_cls,
-                      GNUNET_ARM_REQUEST_SENT_OK,
-                      GNUNET_ARM_RESULT_STOPPED);
-      GNUNET_free(op);
-    }
-  reconnect_arm_later(h);
+  {
+    h->thm = NULL;
+    op->result_cont (op->cont_cls,
+                     GNUNET_ARM_REQUEST_SENT_OK,
+                     GNUNET_ARM_RESULT_STOPPED);
+    GNUNET_free (op);
+  }
+  reconnect_arm_later (h);
 }
 
 
@@ -484,39 +501,48 @@ mq_error_handler(void *cls, enum GNUNET_MQ_Error error)
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
  */
 static int
-reconnect_arm(struct GNUNET_ARM_Handle *h)
+reconnect_arm (struct GNUNET_ARM_Handle *h)
 {
-  struct GNUNET_MQ_MessageHandler handlers[] =
-  { GNUNET_MQ_hd_fixed_size(arm_result,
-                            GNUNET_MESSAGE_TYPE_ARM_RESULT,
-                            struct GNUNET_ARM_ResultMessage,
-                            h),
-    GNUNET_MQ_hd_var_size(arm_list_result,
-                          GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT,
-                          struct GNUNET_ARM_ListResultMessage,
-                          h),
-    GNUNET_MQ_hd_fixed_size(confirm,
-                            GNUNET_MESSAGE_TYPE_ARM_TEST,
-                            struct GNUNET_MessageHeader,
-                            h),
-    GNUNET_MQ_handler_end() };
+  struct GNUNET_MQ_MessageHandler handlers[] = {
+    GNUNET_MQ_hd_fixed_size (arm_result,
+                             GNUNET_MESSAGE_TYPE_ARM_RESULT,
+                             struct GNUNET_ARM_ResultMessage,
+                             h),
+    GNUNET_MQ_hd_var_size (arm_list_result,
+                           GNUNET_MESSAGE_TYPE_ARM_LIST_RESULT,
+                           struct GNUNET_ARM_ListResultMessage,
+                           h),
+    GNUNET_MQ_hd_fixed_size (confirm,
+                             GNUNET_MESSAGE_TYPE_ARM_TEST,
+                             struct GNUNET_MessageHeader,
+                             h),
+    GNUNET_MQ_handler_end ()
+  };
   struct GNUNET_MessageHeader *test;
   struct GNUNET_MQ_Envelope *env;
 
   if (NULL != h->mq)
     return GNUNET_OK;
-  GNUNET_assert(GNUNET_NO == h->currently_up);
-  h->mq = GNUNET_CLIENT_connect(h->cfg, "arm", handlers, &mq_error_handler, h);
+  GNUNET_assert (GNUNET_NO == h->currently_up);
+  h->mq = GNUNET_CLIENT_connect (h->cfg,
+                                 "arm",
+                                 handlers,
+                                 &mq_error_handler,
+                                 h);
   if (NULL == h->mq)
-    {
-      LOG(GNUNET_ERROR_TYPE_DEBUG, "GNUNET_CLIENT_connect returned NULL\n");
-      if (NULL != h->conn_status)
-        h->conn_status(h->conn_status_cls, GNUNET_SYSERR);
-      return GNUNET_SYSERR;
-    }
-  LOG(GNUNET_ERROR_TYPE_DEBUG, "Sending TEST message to ARM\n");
-  env = GNUNET_MQ_msg(test, GNUNET_MESSAGE_TYPE_ARM_TEST);
-  GNUNET_MQ_send(h->mq, env);
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "GNUNET_CLIENT_connect returned NULL\n");
+    if (NULL != h->conn_status)
+      h->conn_status (h->conn_status_cls,
+                      GNUNET_SYSERR);
+    return GNUNET_SYSERR;
+  }
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Sending TEST message to ARM\n");
+  env = GNUNET_MQ_msg (test,
+                       GNUNET_MESSAGE_TYPE_ARM_TEST);
+  GNUNET_MQ_send (h->mq, env);
   return GNUNET_OK;
 }
 
@@ -533,21 +559,21 @@ reconnect_arm(struct GNUNET_ARM_Handle *h)
  * @return context to use for further ARM operations, NULL on error.
  */
 struct GNUNET_ARM_Handle *
-GNUNET_ARM_connect(const struct GNUNET_CONFIGURATION_Handle *cfg,
-                   GNUNET_ARM_ConnectionStatusCallback conn_status,
-                   void *conn_status_cls)
+GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                    GNUNET_ARM_ConnectionStatusCallback conn_status,
+                    void *conn_status_cls)
 {
   struct GNUNET_ARM_Handle *h;
 
-  h = GNUNET_new(struct GNUNET_ARM_Handle);
+  h = GNUNET_new (struct GNUNET_ARM_Handle);
   h->cfg = cfg;
   h->conn_status = conn_status;
   h->conn_status_cls = conn_status_cls;
-  if (GNUNET_OK != reconnect_arm(h))
-    {
-      GNUNET_free(h);
-      return NULL;
-    }
+  if (GNUNET_OK != reconnect_arm (h))
+  {
+    GNUNET_free (h);
+    return NULL;
+  }
   return h;
 }
 
@@ -558,38 +584,43 @@ GNUNET_ARM_connect(const struct 
GNUNET_CONFIGURATION_Handle *cfg,
  * @param h the handle that was being used
  */
 void
-GNUNET_ARM_disconnect(struct GNUNET_ARM_Handle *h)
+GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h)
 {
   struct GNUNET_ARM_Operation *op;
 
-  LOG(GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from ARM service\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from ARM service\n");
   while (NULL != (op = h->operation_pending_head))
+  {
+    GNUNET_CONTAINER_DLL_remove (h->operation_pending_head,
+                                 h->operation_pending_tail,
+                                 op);
+    if (NULL != op->result_cont)
+      op->result_cont (op->cont_cls,
+                       GNUNET_ARM_REQUEST_DISCONNECTED,
+                       0);
+    if (NULL != op->list_cont)
+      op->list_cont (op->cont_cls,
+                     GNUNET_ARM_REQUEST_DISCONNECTED,
+                     0,
+                     NULL);
+    if (NULL != op->async)
     {
-      GNUNET_CONTAINER_DLL_remove(h->operation_pending_head,
-                                  h->operation_pending_tail,
-                                  op);
-      if (NULL != op->result_cont)
-        op->result_cont(op->cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, 0);
-      if (NULL != op->list_cont)
-        op->list_cont(op->cont_cls, GNUNET_ARM_REQUEST_DISCONNECTED, 0, NULL);
-      if (NULL != op->async)
-        {
-          GNUNET_SCHEDULER_cancel(op->async);
-          op->async = NULL;
-        }
-      GNUNET_free(op);
+      GNUNET_SCHEDULER_cancel (op->async);
+      op->async = NULL;
     }
+    GNUNET_free (op);
+  }
   if (NULL != h->mq)
-    {
-      GNUNET_MQ_destroy(h->mq);
-      h->mq = NULL;
-    }
+  {
+    GNUNET_MQ_destroy (h->mq);
+    h->mq = NULL;
+  }
   if (NULL != h->reconnect_task)
-    {
-      GNUNET_SCHEDULER_cancel(h->reconnect_task);
-      h->reconnect_task = NULL;
-    }
-  GNUNET_free(h);
+  {
+    GNUNET_SCHEDULER_cancel (h->reconnect_task);
+    h->reconnect_task = NULL;
+  }
+  GNUNET_free (h);
 }
 
 
@@ -602,8 +633,8 @@ GNUNET_ARM_disconnect(struct GNUNET_ARM_Handle *h)
  * @return operation status code
  */
 static enum GNUNET_ARM_Result
-start_arm_service(struct GNUNET_ARM_Handle *h,
-                  enum GNUNET_OS_InheritStdioFlags std_inheritance)
+start_arm_service (struct GNUNET_ARM_Handle *h,
+                   enum GNUNET_OS_InheritStdioFlags std_inheritance)
 {
   struct GNUNET_OS_Process *proc;
   char *cbinary;
@@ -613,98 +644,111 @@ start_arm_service(struct GNUNET_ARM_Handle *h,
   char *loprefix;
   char *lopostfix;
 
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string(h->cfg,
-                                                         "arm",
-                                                         "PREFIX",
-                                                         &loprefix))
-    loprefix = GNUNET_strdup("");
+  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (h->cfg,
+                                                          "arm",
+                                                          "PREFIX",
+                                                          &loprefix))
+    loprefix = GNUNET_strdup ("");
   else
-    loprefix = GNUNET_CONFIGURATION_expand_dollar(h->cfg, loprefix);
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string(h->cfg,
-                                                         "arm",
-                                                         "OPTIONS",
-                                                         &lopostfix))
-    lopostfix = GNUNET_strdup("");
+    loprefix = GNUNET_CONFIGURATION_expand_dollar (h->cfg, loprefix);
+  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (h->cfg,
+                                                          "arm",
+                                                          "OPTIONS",
+                                                          &lopostfix))
+    lopostfix = GNUNET_strdup ("");
   else
-    lopostfix = GNUNET_CONFIGURATION_expand_dollar(h->cfg, lopostfix);
+    lopostfix = GNUNET_CONFIGURATION_expand_dollar (h->cfg,
+                                                    lopostfix);
   if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_string(h->cfg, "arm", "BINARY", &cbinary))
-    {
-      GNUNET_log_config_missing(GNUNET_ERROR_TYPE_WARNING, "arm", "BINARY");
-      GNUNET_free(loprefix);
-      GNUNET_free(lopostfix);
-      return GNUNET_ARM_RESULT_IS_NOT_KNOWN;
-    }
-  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename(h->cfg,
-                                                           "arm",
-                                                           "CONFIG",
-                                                           &config))
+      GNUNET_CONFIGURATION_get_value_string (h->cfg,
+                                             "arm",
+                                             "BINARY",
+                                             &cbinary))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING,
+                               "arm",
+                               "BINARY");
+    GNUNET_free (loprefix);
+    GNUNET_free (lopostfix);
+    return GNUNET_ARM_RESULT_IS_NOT_KNOWN;
+  }
+  if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (h->cfg,
+                                                            "arm",
+                                                            "CONFIG",
+                                                            &config))
     config = NULL;
-  binary = GNUNET_OS_get_libexec_binary_path(cbinary);
-  GNUNET_asprintf(&quotedbinary, "\"%s\"", binary);
-  GNUNET_free(cbinary);
-  if ((GNUNET_YES ==
-       GNUNET_CONFIGURATION_have_value(h->cfg, "TESTING", "WEAKRANDOM")) &&
-      (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(h->cfg,
-                                                          "TESTING",
-                                                          "WEAKRANDOM")) &&
-      (GNUNET_NO ==
-       GNUNET_CONFIGURATION_have_value(h->cfg, "TESTING", "HOSTFILE")))
-    {
-      /* Means we are ONLY running locally */
-      /* we're clearly running a test, don't daemonize */
-      if (NULL == config)
-        proc = GNUNET_OS_start_process_s(GNUNET_NO,
-                                         std_inheritance,
-                                         NULL,
-                                         loprefix,
-                                         quotedbinary,
-                                         /* no daemonization! */
-                                         lopostfix,
-                                         NULL);
-      else
-        proc = GNUNET_OS_start_process_s(GNUNET_NO,
-                                         std_inheritance,
-                                         NULL,
-                                         loprefix,
-                                         quotedbinary,
-                                         "-c",
-                                         config,
-                                         /* no daemonization! */
-                                         lopostfix,
-                                         NULL);
-    }
+  binary = GNUNET_OS_get_libexec_binary_path (cbinary);
+  GNUNET_asprintf (&quotedbinary,
+                   "\"%s\"",
+                   binary);
+  GNUNET_free (cbinary);
+  if ( (GNUNET_YES ==
+        GNUNET_CONFIGURATION_have_value (h->cfg,
+                                         "TESTING",
+                                         "WEAKRANDOM")) &&
+       (GNUNET_YES ==
+        GNUNET_CONFIGURATION_get_value_yesno (h->cfg,
+                                              "TESTING",
+                                              "WEAKRANDOM")) &&
+       (GNUNET_NO ==
+        GNUNET_CONFIGURATION_have_value (h->cfg,
+                                         "TESTING",
+                                         "HOSTFILE")) )
+  {
+    /* Means we are ONLY running locally */
+    /* we're clearly running a test, don't daemonize */
+    if (NULL == config)
+      proc = GNUNET_OS_start_process_s (GNUNET_NO,
+                                        std_inheritance,
+                                        NULL,
+                                        loprefix,
+                                        quotedbinary,
+                                        /* no daemonization! */
+                                        lopostfix,
+                                        NULL);
+    else
+      proc = GNUNET_OS_start_process_s (GNUNET_NO,
+                                        std_inheritance,
+                                        NULL,
+                                        loprefix,
+                                        quotedbinary,
+                                        "-c",
+                                        config,
+                                        /* no daemonization! */
+                                        lopostfix,
+                                        NULL);
+  }
   else
-    {
-      if (NULL == config)
-        proc = GNUNET_OS_start_process_s(GNUNET_NO,
-                                         std_inheritance,
-                                         NULL,
-                                         loprefix,
-                                         quotedbinary,
-                                         "-d", /* do daemonize */
-                                         lopostfix,
-                                         NULL);
-      else
-        proc = GNUNET_OS_start_process_s(GNUNET_NO,
-                                         std_inheritance,
-                                         NULL,
-                                         loprefix,
-                                         quotedbinary,
-                                         "-c",
-                                         config,
-                                         "-d", /* do daemonize */
-                                         lopostfix,
-                                         NULL);
-    }
-  GNUNET_free(binary);
-  GNUNET_free(quotedbinary);
-  GNUNET_free_non_null(config);
-  GNUNET_free(loprefix);
-  GNUNET_free(lopostfix);
+  {
+    if (NULL == config)
+      proc = GNUNET_OS_start_process_s (GNUNET_NO,
+                                        std_inheritance,
+                                        NULL,
+                                        loprefix,
+                                        quotedbinary,
+                                        "-d",  /* do daemonize */
+                                        lopostfix,
+                                        NULL);
+    else
+      proc = GNUNET_OS_start_process_s (GNUNET_NO,
+                                        std_inheritance,
+                                        NULL,
+                                        loprefix,
+                                        quotedbinary,
+                                        "-c",
+                                        config,
+                                        "-d",  /* do daemonize */
+                                        lopostfix,
+                                        NULL);
+  }
+  GNUNET_free (binary);
+  GNUNET_free (quotedbinary);
+  GNUNET_free_non_null (config);
+  GNUNET_free (loprefix);
+  GNUNET_free (lopostfix);
   if (NULL == proc)
     return GNUNET_ARM_RESULT_START_FAILED;
-  GNUNET_OS_process_destroy(proc);
+  GNUNET_OS_process_destroy (proc);
   return GNUNET_ARM_RESULT_STARTING;
 }
 
@@ -716,19 +760,19 @@ start_arm_service(struct GNUNET_ARM_Handle *h,
  * @param op operation to cancel
  */
 void
-GNUNET_ARM_operation_cancel(struct GNUNET_ARM_Operation *op)
+GNUNET_ARM_operation_cancel (struct GNUNET_ARM_Operation *op)
 {
   struct GNUNET_ARM_Handle *h = op->h;
 
   if (h->thm == op)
-    {
-      op->result_cont = NULL;
-      return;
-    }
-  GNUNET_CONTAINER_DLL_remove(h->operation_pending_head,
-                              h->operation_pending_tail,
-                              op);
-  GNUNET_free(op);
+  {
+    op->result_cont = NULL;
+    return;
+  }
+  GNUNET_CONTAINER_DLL_remove (h->operation_pending_head,
+                               h->operation_pending_tail,
+                               op);
+  GNUNET_free (op);
 }
 
 
@@ -743,38 +787,38 @@ GNUNET_ARM_operation_cancel(struct GNUNET_ARM_Operation 
*op)
  * @return handle to queue, NULL on error
  */
 static struct GNUNET_ARM_Operation *
-change_service(struct GNUNET_ARM_Handle *h,
-               const char *service_name,
-               GNUNET_ARM_ResultCallback cb,
-               void *cb_cls,
-               uint16_t type)
+change_service (struct GNUNET_ARM_Handle *h,
+                const char *service_name,
+                GNUNET_ARM_ResultCallback cb,
+                void *cb_cls,
+                uint16_t type)
 {
   struct GNUNET_ARM_Operation *op;
   size_t slen;
   struct GNUNET_MQ_Envelope *env;
   struct GNUNET_ARM_Message *msg;
 
-  slen = strlen(service_name) + 1;
+  slen = strlen (service_name) + 1;
   if (slen + sizeof(struct GNUNET_ARM_Message) >= GNUNET_MAX_MESSAGE_SIZE)
-    {
-      GNUNET_break(0);
-      return NULL;
-    }
+  {
+    GNUNET_break (0);
+    return NULL;
+  }
   if (0 == h->request_id_counter)
     h->request_id_counter++;
-  op = GNUNET_new(struct GNUNET_ARM_Operation);
+  op = GNUNET_new (struct GNUNET_ARM_Operation);
   op->h = h;
   op->result_cont = cb;
   op->cont_cls = cb_cls;
   op->id = h->request_id_counter++;
-  GNUNET_CONTAINER_DLL_insert_tail(h->operation_pending_head,
-                                   h->operation_pending_tail,
-                                   op);
-  env = GNUNET_MQ_msg_extra(msg, slen, type);
-  msg->reserved = htonl(0);
-  msg->request_id = GNUNET_htonll(op->id);
-  GNUNET_memcpy(&msg[1], service_name, slen);
-  GNUNET_MQ_send(h->mq, env);
+  GNUNET_CONTAINER_DLL_insert_tail (h->operation_pending_head,
+                                    h->operation_pending_tail,
+                                    op);
+  env = GNUNET_MQ_msg_extra (msg, slen, type);
+  msg->reserved = htonl (0);
+  msg->request_id = GNUNET_htonll (op->id);
+  GNUNET_memcpy (&msg[1], service_name, slen);
+  GNUNET_MQ_send (h->mq, env);
   return op;
 }
 
@@ -785,22 +829,24 @@ change_service(struct GNUNET_ARM_Handle *h,
  * @param cls the operation that asked ARM to be started
  */
 static void
-notify_running(void *cls)
+notify_running (void *cls)
 {
   struct GNUNET_ARM_Operation *op = cls;
   struct GNUNET_ARM_Handle *h = op->h;
 
   op->async = NULL;
-  GNUNET_CONTAINER_DLL_remove(h->operation_pending_head,
-                              h->operation_pending_tail,
-                              op);
+  GNUNET_CONTAINER_DLL_remove (h->operation_pending_head,
+                               h->operation_pending_tail,
+                               op);
   if (NULL != op->result_cont)
-    op->result_cont(op->cont_cls,
-                    GNUNET_ARM_REQUEST_SENT_OK,
-                    GNUNET_ARM_RESULT_IS_STARTED_ALREADY);
-  if ((GNUNET_YES == h->currently_up) && (NULL != h->conn_status))
-    h->conn_status(h->conn_status_cls, GNUNET_YES);
-  GNUNET_free(op);
+    op->result_cont (op->cont_cls,
+                     GNUNET_ARM_REQUEST_SENT_OK,
+                     GNUNET_ARM_RESULT_IS_STARTED_ALREADY);
+  if ( (GNUNET_YES == h->currently_up) &&
+       (NULL != h->conn_status) )
+    h->conn_status (h->conn_status_cls,
+                    GNUNET_YES);
+  GNUNET_free (op);
 }
 
 
@@ -810,22 +856,22 @@ notify_running(void *cls)
  * @param cls the operation that asked ARM to be started
  */
 static void
-notify_starting(void *cls)
+notify_starting (void *cls)
 {
   struct GNUNET_ARM_Operation *op = cls;
   struct GNUNET_ARM_Handle *h = op->h;
 
   op->async = NULL;
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "Notifying client that we started the ARM service\n");
-  GNUNET_CONTAINER_DLL_remove(h->operation_pending_head,
-                              h->operation_pending_tail,
-                              op);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Notifying client that we started the ARM service\n");
+  GNUNET_CONTAINER_DLL_remove (h->operation_pending_head,
+                               h->operation_pending_tail,
+                               op);
   if (NULL != op->result_cont)
-    op->result_cont(op->cont_cls,
-                    GNUNET_ARM_REQUEST_SENT_OK,
-                    op->starting_ret);
-  GNUNET_free(op);
+    op->result_cont (op->cont_cls,
+                     GNUNET_ARM_REQUEST_SENT_OK,
+                     op->starting_ret);
+  GNUNET_free (op);
 }
 
 
@@ -840,23 +886,26 @@ notify_starting(void *cls)
  * @return handle for the operation, NULL on error
  */
 struct GNUNET_ARM_Operation *
-GNUNET_ARM_request_service_start(
-  struct GNUNET_ARM_Handle *h,
-  const char *service_name,
-  enum GNUNET_OS_InheritStdioFlags std_inheritance,
-  GNUNET_ARM_ResultCallback cont,
-  void *cont_cls)
+GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
+                                  const char *service_name,
+                                  enum GNUNET_OS_InheritStdioFlags
+                                  std_inheritance,
+                                  GNUNET_ARM_ResultCallback cont,
+                                  void *cont_cls)
 {
   struct GNUNET_ARM_Operation *op;
   enum GNUNET_ARM_Result ret;
 
-  LOG(GNUNET_ERROR_TYPE_DEBUG, "Starting service `%s'\n", service_name);
-  if (0 != strcasecmp("arm", service_name))
-    return change_service(h,
-                          service_name,
-                          cont,
-                          cont_cls,
-                          GNUNET_MESSAGE_TYPE_ARM_START);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Starting service `%s'\n",
+       service_name);
+  if (0 != strcasecmp ("arm",
+                       service_name))
+    return change_service (h,
+                           service_name,
+                           cont,
+                           cont_cls,
+                           GNUNET_MESSAGE_TYPE_ARM_START);
 
   /* Possible cases:
    * 1) We're connected to ARM already. Invoke the callback immediately.
@@ -865,37 +914,39 @@ GNUNET_ARM_request_service_start(
    *    a service test.
    */
   if (GNUNET_YES == h->currently_up)
-    {
-      LOG(GNUNET_ERROR_TYPE_DEBUG, "ARM is already running\n");
-      op = GNUNET_new(struct GNUNET_ARM_Operation);
-      op->h = h;
-      op->result_cont = cont;
-      op->cont_cls = cont_cls;
-      GNUNET_CONTAINER_DLL_insert_tail(h->operation_pending_head,
-                                       h->operation_pending_tail,
-                                       op);
-      op->async = GNUNET_SCHEDULER_add_now(&notify_running, op);
-      return op;
-    }
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "ARM is already running\n");
+    op = GNUNET_new (struct GNUNET_ARM_Operation);
+    op->h = h;
+    op->result_cont = cont;
+    op->cont_cls = cont_cls;
+    GNUNET_CONTAINER_DLL_insert_tail (h->operation_pending_head,
+                                      h->operation_pending_tail,
+                                      op);
+    op->async = GNUNET_SCHEDULER_add_now (&notify_running, op);
+    return op;
+  }
   /* This is an inherently uncertain choice, as it is of course
      theoretically possible that ARM is up and we just did not
      yet complete the MQ handshake.  However, given that users
      are unlikely to hammer 'gnunet-arm -s' on a busy system,
      the above check should catch 99.99% of the cases where ARM
      is already running. */
-  LOG(GNUNET_ERROR_TYPE_DEBUG, "Starting ARM service\n");
-  ret = start_arm_service(h, std_inheritance);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting ARM service\n");
+  ret = start_arm_service (h, std_inheritance);
   if (GNUNET_ARM_RESULT_STARTING == ret)
-    reconnect_arm(h);
-  op = GNUNET_new(struct GNUNET_ARM_Operation);
+    reconnect_arm (h);
+  op = GNUNET_new (struct GNUNET_ARM_Operation);
   op->h = h;
   op->result_cont = cont;
   op->cont_cls = cont_cls;
-  GNUNET_CONTAINER_DLL_insert_tail(h->operation_pending_head,
-                                   h->operation_pending_tail,
-                                   op);
+  GNUNET_CONTAINER_DLL_insert_tail (h->operation_pending_head,
+                                    h->operation_pending_tail,
+                                    op);
   op->starting_ret = ret;
-  op->async = GNUNET_SCHEDULER_add_now(&notify_starting, op);
+  op->async = GNUNET_SCHEDULER_add_now (&notify_starting,
+                                        op);
   return op;
 }
 
@@ -915,24 +966,27 @@ GNUNET_ARM_request_service_start(
  * @return handle for the operation, NULL on error
  */
 struct GNUNET_ARM_Operation *
-GNUNET_ARM_request_service_stop(struct GNUNET_ARM_Handle *h,
-                                const char *service_name,
-                                GNUNET_ARM_ResultCallback cont,
-                                void *cont_cls)
+GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h,
+                                 const char *service_name,
+                                 GNUNET_ARM_ResultCallback cont,
+                                 void *cont_cls)
 {
   struct GNUNET_ARM_Operation *op;
 
-  LOG(GNUNET_ERROR_TYPE_DEBUG, "Stopping service `%s'\n", service_name);
-  op = change_service(h,
-                      service_name,
-                      cont,
-                      cont_cls,
-                      GNUNET_MESSAGE_TYPE_ARM_STOP);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Stopping service `%s'\n",
+       service_name);
+  op = change_service (h,
+                       service_name,
+                       cont,
+                       cont_cls,
+                       GNUNET_MESSAGE_TYPE_ARM_STOP);
   if (NULL == op)
     return NULL;
   /* If the service is ARM, set a flag as we will use MQ errors
      to detect that the process is really gone. */
-  if (0 == strcasecmp(service_name, "arm"))
+  if (0 == strcasecmp (service_name,
+                       "arm"))
     op->is_arm_stop = GNUNET_YES;
   return op;
 }
@@ -947,29 +1001,31 @@ GNUNET_ARM_request_service_stop(struct GNUNET_ARM_Handle 
*h,
  * @return handle for the operation, NULL on error
  */
 struct GNUNET_ARM_Operation *
-GNUNET_ARM_request_service_list(struct GNUNET_ARM_Handle *h,
-                                GNUNET_ARM_ServiceListCallback cont,
-                                void *cont_cls)
+GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h,
+                                 GNUNET_ARM_ServiceListCallback cont,
+                                 void *cont_cls)
 {
   struct GNUNET_ARM_Operation *op;
   struct GNUNET_MQ_Envelope *env;
   struct GNUNET_ARM_Message *msg;
 
-  LOG(GNUNET_ERROR_TYPE_DEBUG, "Requesting LIST from ARM service\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Requesting LIST from ARM service\n");
   if (0 == h->request_id_counter)
     h->request_id_counter++;
-  op = GNUNET_new(struct GNUNET_ARM_Operation);
+  op = GNUNET_new (struct GNUNET_ARM_Operation);
   op->h = h;
   op->list_cont = cont;
   op->cont_cls = cont_cls;
   op->id = h->request_id_counter++;
-  GNUNET_CONTAINER_DLL_insert_tail(h->operation_pending_head,
-                                   h->operation_pending_tail,
-                                   op);
-  env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_ARM_LIST);
-  msg->reserved = htonl(0);
-  msg->request_id = GNUNET_htonll(op->id);
-  GNUNET_MQ_send(h->mq, env);
+  GNUNET_CONTAINER_DLL_insert_tail (h->operation_pending_head,
+                                    h->operation_pending_tail,
+                                    op);
+  env = GNUNET_MQ_msg (msg,
+                       GNUNET_MESSAGE_TYPE_ARM_LIST);
+  msg->reserved = htonl (0);
+  msg->request_id = GNUNET_htonll (op->id);
+  GNUNET_MQ_send (h->mq, env);
   return op;
 }
 
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c
index 2670ac9b8..0fdb66fa0 100644
--- a/src/arm/gnunet-arm.c
+++ b/src/arm/gnunet-arm.c
@@ -149,25 +149,25 @@ static struct GNUNET_ARM_Operation *op;
  * were specified when gnunet-arm was run.
  */
 static void
-delete_files()
+delete_files ()
 {
-  GNUNET_log(
+  GNUNET_log (
     GNUNET_ERROR_TYPE_DEBUG,
     "Will attempt to remove configuration file %s and service directory %s\n",
     config_file,
     dir);
-  if (0 != unlink(config_file))
-    {
-      GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
-                 _("Failed to remove configuration file %s\n"),
-                 config_file);
-    }
-  if (GNUNET_OK != GNUNET_DISK_directory_remove(dir))
-    {
-      GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
-                 _("Failed to remove servicehome directory %s\n"),
-                 dir);
-    }
+  if (0 != unlink (config_file))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                _ ("Failed to remove configuration file %s\n"),
+                config_file);
+  }
+  if (GNUNET_OK != GNUNET_DISK_directory_remove (dir))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                _ ("Failed to remove servicehome directory %s\n"),
+                dir);
+  }
 }
 
 
@@ -178,37 +178,38 @@ delete_files()
  * @param cls closure, unused
  */
 static void
-shutdown_task(void *cls)
+shutdown_task (void *cls)
 {
-  (void)cls;
+  (void) cls;
   if (NULL != al_task)
-    {
-      GNUNET_SCHEDULER_cancel(al_task);
-      al_task = NULL;
-    }
+  {
+    GNUNET_SCHEDULER_cancel (al_task);
+    al_task = NULL;
+  }
   if (NULL != op)
-    {
-      GNUNET_ARM_operation_cancel(op);
-      op = NULL;
-    }
+  {
+    GNUNET_ARM_operation_cancel (op);
+    op = NULL;
+  }
   if (NULL != h)
-    {
-      GNUNET_ARM_disconnect(h);
-      h = NULL;
-    }
+  {
+    GNUNET_ARM_disconnect (h);
+    h = NULL;
+  }
   if (NULL != m)
-    {
-      GNUNET_ARM_monitor_stop(m);
-      m = NULL;
-    }
+  {
+    GNUNET_ARM_monitor_stop (m);
+    m = NULL;
+  }
   if (NULL != timeout_task)
-    {
-      GNUNET_SCHEDULER_cancel(timeout_task);
-      timeout_task = NULL;
-    }
-  if ((GNUNET_YES == end) && (GNUNET_YES == delete))
-    delete_files();
-  GNUNET_CONFIGURATION_destroy(cfg);
+  {
+    GNUNET_SCHEDULER_cancel (timeout_task);
+    timeout_task = NULL;
+  }
+  if ( (GNUNET_YES == end) &&
+       (GNUNET_YES == delete) )
+    delete_files ();
+  GNUNET_CONFIGURATION_destroy (cfg);
   cfg = NULL;
 }
 
@@ -220,17 +221,17 @@ shutdown_task(void *cls)
  * @return a string interpretation of the request status
  */
 static const char *
-req_string(enum GNUNET_ARM_RequestStatus rs)
+req_string (enum GNUNET_ARM_RequestStatus rs)
 {
   switch (rs)
-    {
-    case GNUNET_ARM_REQUEST_SENT_OK:
-      return _("Message was sent successfully");
+  {
+  case GNUNET_ARM_REQUEST_SENT_OK:
+    return _ ("Message was sent successfully");
 
-    case GNUNET_ARM_REQUEST_DISCONNECTED:
-      return _("We disconnected from ARM before we could send a request");
-    }
-  return _("Unknown request status");
+  case GNUNET_ARM_REQUEST_DISCONNECTED:
+    return _ ("We disconnected from ARM before we could send a request");
+  }
+  return _ ("Unknown request status");
 }
 
 
@@ -241,41 +242,41 @@ req_string(enum GNUNET_ARM_RequestStatus rs)
  * @return a string interpretation
  */
 static const char *
-ret_string(enum GNUNET_ARM_Result result)
+ret_string (enum GNUNET_ARM_Result result)
 {
   switch (result)
-    {
-    case GNUNET_ARM_RESULT_STOPPED:
-      return _("is stopped");
+  {
+  case GNUNET_ARM_RESULT_STOPPED:
+    return _ ("is stopped");
 
-    case GNUNET_ARM_RESULT_STARTING:
-      return _("is starting");
+  case GNUNET_ARM_RESULT_STARTING:
+    return _ ("is starting");
 
-    case GNUNET_ARM_RESULT_STOPPING:
-      return _("is stopping");
+  case GNUNET_ARM_RESULT_STOPPING:
+    return _ ("is stopping");
 
-    case GNUNET_ARM_RESULT_IS_STARTING_ALREADY:
-      return _("is starting already");
+  case GNUNET_ARM_RESULT_IS_STARTING_ALREADY:
+    return _ ("is starting already");
 
-    case GNUNET_ARM_RESULT_IS_STOPPING_ALREADY:
-      return _("is stopping already");
+  case GNUNET_ARM_RESULT_IS_STOPPING_ALREADY:
+    return _ ("is stopping already");
 
-    case GNUNET_ARM_RESULT_IS_STARTED_ALREADY:
-      return _("is started already");
+  case GNUNET_ARM_RESULT_IS_STARTED_ALREADY:
+    return _ ("is started already");
 
-    case GNUNET_ARM_RESULT_IS_STOPPED_ALREADY:
-      return _("is stopped already");
+  case GNUNET_ARM_RESULT_IS_STOPPED_ALREADY:
+    return _ ("is stopped already");
 
-    case GNUNET_ARM_RESULT_IS_NOT_KNOWN:
-      return _("service is not known to ARM");
+  case GNUNET_ARM_RESULT_IS_NOT_KNOWN:
+    return _ ("service is not known to ARM");
 
-    case GNUNET_ARM_RESULT_START_FAILED:
-      return _("service failed to start");
+  case GNUNET_ARM_RESULT_START_FAILED:
+    return _ ("service failed to start");
 
-    case GNUNET_ARM_RESULT_IN_SHUTDOWN:
-      return _("service cannot be manipulated because ARM is shutting down");
-    }
-  return _("Unknown result code.");
+  case GNUNET_ARM_RESULT_IN_SHUTDOWN:
+    return _ ("service cannot be manipulated because ARM is shutting down");
+  }
+  return _ ("Unknown result code.");
 }
 
 
@@ -285,7 +286,7 @@ ret_string(enum GNUNET_ARM_Result result)
  * @param cls closure
  */
 static void
-action_loop(void *cls);
+action_loop (void *cls);
 
 
 /**
@@ -298,18 +299,20 @@ action_loop(void *cls);
  *                  #GNUNET_SYSERR on error.
  */
 static void
-conn_status(void *cls, int connected)
+conn_status (void *cls,
+             int connected)
 {
   static int once;
 
-  (void)cls;
-  if ((GNUNET_SYSERR == connected) && (0 == once))
-    {
-      GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
-                 _("Fatal error initializing ARM API.\n"));
-      GNUNET_SCHEDULER_shutdown();
-      return;
-    }
+  (void) cls;
+  if ( (GNUNET_SYSERR == connected) &&
+       (0 == once) )
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                _ ("Fatal error initializing ARM API.\n"));
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
   once = 1;
 }
 
@@ -326,32 +329,34 @@ conn_status(void *cls, int connected)
  *               according to ARM
  */
 static void
-start_callback(void *cls,
-               enum GNUNET_ARM_RequestStatus rs,
-               enum GNUNET_ARM_Result result)
+start_callback (void *cls,
+                enum GNUNET_ARM_RequestStatus rs,
+                enum GNUNET_ARM_Result result)
 {
-  (void)cls;
+  (void) cls;
   op = NULL;
   if (GNUNET_ARM_REQUEST_SENT_OK != rs)
-    {
-      fprintf(stdout,
-              _("Failed to start the ARM service: %s\n"),
-              req_string(rs));
-      GNUNET_SCHEDULER_shutdown();
-      return;
-    }
+  {
+    fprintf (stdout,
+             _ ("Failed to start the ARM service: %s\n"),
+             req_string (rs));
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
   if ((GNUNET_ARM_RESULT_STARTING != result) &&
       (GNUNET_ARM_RESULT_IS_STARTED_ALREADY != result))
-    {
-      fprintf(stdout,
-              _("Failed to start the ARM service: %s\n"),
-              ret_string(result));
-      GNUNET_SCHEDULER_shutdown();
-      return;
-    }
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "ARM service [re]start successful\n");
+  {
+    fprintf (stdout,
+             _ ("Failed to start the ARM service: %s\n"),
+             ret_string (result));
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "ARM service [re]start successful\n");
   start = 0;
-  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
+  al_task = GNUNET_SCHEDULER_add_now (&action_loop,
+                                      NULL);
 }
 
 
@@ -367,44 +372,47 @@ start_callback(void *cls,
  *               according to ARM
  */
 static void
-stop_callback(void *cls,
-              enum GNUNET_ARM_RequestStatus rs,
-              enum GNUNET_ARM_Result result)
+stop_callback (void *cls,
+               enum GNUNET_ARM_RequestStatus rs,
+               enum GNUNET_ARM_Result result)
 {
   char *msg;
 
-  (void)cls;
+  (void) cls;
   op = NULL;
   if (GNUNET_ARM_REQUEST_SENT_OK != rs)
-    {
-      GNUNET_asprintf(&msg,
-                      "%s",
-                      _(
-                        "Failed to send a stop request to the ARM service: 
%s\n"));
-      fprintf(stdout, msg, req_string(rs));
-      GNUNET_free(msg);
-      GNUNET_SCHEDULER_shutdown();
-      return;
-    }
-  if ((GNUNET_ARM_RESULT_STOPPING != result) &&
-      (GNUNET_ARM_RESULT_STOPPED != result) &&
-      (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result))
-    {
-      fprintf(stdout,
-              _("Failed to stop the ARM service: %s\n"),
-              ret_string(result));
-      GNUNET_SCHEDULER_shutdown();
-      return;
-    }
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "ARM service shutdown successful\n");
+  {
+    GNUNET_asprintf (&msg,
+                     "%s",
+                     _ (
+                       "Failed to send a stop request to the ARM service: 
%s\n"));
+    fprintf (stdout, msg, req_string (rs));
+    GNUNET_free (msg);
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
+  if ( (GNUNET_ARM_RESULT_STOPPING != result) &&
+       (GNUNET_ARM_RESULT_STOPPED != result) &&
+       (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result) )
+  {
+    fprintf (stdout,
+             _ ("Failed to stop the ARM service: %s\n"),
+             ret_string (result));
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "ARM service shutdown successful\n");
   end = 0;
   if (restart)
-    {
-      restart = 0;
-      start = 1;
-      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Initiating an ARM restart\n");
-    }
-  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
+  {
+    restart = 0;
+    start = 1;
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Initiating an ARM restart\n");
+  }
+  al_task = GNUNET_SCHEDULER_add_now (&action_loop,
+                                      NULL);
 }
 
 
@@ -420,37 +428,38 @@ stop_callback(void *cls,
  *               according to ARM
  */
 static void
-init_callback(void *cls,
-              enum GNUNET_ARM_RequestStatus rs,
-              enum GNUNET_ARM_Result result)
+init_callback (void *cls,
+               enum GNUNET_ARM_RequestStatus rs,
+               enum GNUNET_ARM_Result result)
 {
-  (void)cls;
+  (void) cls;
   op = NULL;
   if (GNUNET_ARM_REQUEST_SENT_OK != rs)
-    {
-      fprintf(stdout,
-              _("Failed to send a request to start the `%s' service: %s\n"),
-              init,
-              req_string(rs));
-      GNUNET_SCHEDULER_shutdown();
-      return;
-    }
+  {
+    fprintf (stdout,
+             _ ("Failed to send a request to start the `%s' service: %s\n"),
+             init,
+             req_string (rs));
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
   if ((GNUNET_ARM_RESULT_STARTING != result) &&
       (GNUNET_ARM_RESULT_IS_STARTED_ALREADY != result))
-    {
-      fprintf(stdout,
-              _("Failed to start the `%s' service: %s\n"),
-              init,
-              ret_string(result));
-      GNUNET_SCHEDULER_shutdown();
-      return;
-    }
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-             "Service %s [re]started successfully\n",
-             init);
-  GNUNET_free(init);
+  {
+    fprintf (stdout,
+             _ ("Failed to start the `%s' service: %s\n"),
+             init,
+             ret_string (result));
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Service %s [re]started successfully\n",
+              init);
+  GNUNET_free (init);
   init = NULL;
-  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
+  al_task = GNUNET_SCHEDULER_add_now (&action_loop,
+                                      NULL);
 }
 
 
@@ -466,42 +475,45 @@ init_callback(void *cls,
  *               according to ARM
  */
 static void
-term_callback(void *cls,
-              enum GNUNET_ARM_RequestStatus rs,
-              enum GNUNET_ARM_Result result)
+term_callback (void *cls,
+               enum GNUNET_ARM_RequestStatus rs,
+               enum GNUNET_ARM_Result result)
 {
   char *msg;
 
-  (void)cls;
+  (void) cls;
   op = NULL;
   if (GNUNET_ARM_REQUEST_SENT_OK != rs)
-    {
-      GNUNET_asprintf(&msg,
-                      _(
-                        "Failed to send a request to kill the `%s' service: 
%%s\n"),
-                      term);
-      fprintf(stdout, msg, req_string(rs));
-      GNUNET_free(msg);
-      GNUNET_SCHEDULER_shutdown();
-      return;
-    }
-  if ((GNUNET_ARM_RESULT_STOPPED != result) &&
-      (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result))
-    {
-      fprintf(stdout,
-              _("Failed to kill the `%s' service: %s\n"),
-              term,
-              ret_string(result));
-      GNUNET_SCHEDULER_shutdown();
-      return;
-    }
+  {
+    GNUNET_asprintf (&msg,
+                     _ (
+                       "Failed to send a request to kill the `%s' service: 
%%s\n"),
+                     term);
+    fprintf (stdout,
+             msg,
+             req_string (rs));
+    GNUNET_free (msg);
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
+  if ( (GNUNET_ARM_RESULT_STOPPED != result) &&
+       (GNUNET_ARM_RESULT_IS_STOPPED_ALREADY != result) )
+  {
+    fprintf (stdout,
+             _ ("Failed to kill the `%s' service: %s\n"),
+             term,
+             ret_string (result));
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
 
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-             "Service %s stopped successfully\n",
-             term);
-  GNUNET_free(term);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Service %s stopped successfully\n",
+              term);
+  GNUNET_free (term);
   term = NULL;
-  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
+  al_task = GNUNET_SCHEDULER_add_now (&action_loop,
+                                      NULL);
 }
 
 
@@ -516,115 +528,140 @@ term_callback(void *cls,
  * @param list list of services managed by arm
  */
 static void
-list_callback(void *cls,
-              enum GNUNET_ARM_RequestStatus rs,
-              unsigned int count,
-              const struct GNUNET_ARM_ServiceInfo *list)
+list_callback (void *cls,
+               enum GNUNET_ARM_RequestStatus rs,
+               unsigned int count,
+               const struct GNUNET_ARM_ServiceInfo *list)
 {
   unsigned int num_stopped = 0;
   unsigned int num_started = 0;
   unsigned int num_stopping = 0;
   unsigned int num_failed = 0;
   unsigned int num_finished = 0;
-  (void)cls;
+  (void) cls;
   op = NULL;
   if (GNUNET_ARM_REQUEST_SENT_OK != rs)
-    {
-      char *msg;
-
-      GNUNET_asprintf(&msg,
-                      "%s",
-                      _("Failed to request a list of services: %s\n"));
-      fprintf(stdout, msg, req_string(rs));
-      GNUNET_free(msg);
-      ret = 3;
-      GNUNET_SCHEDULER_shutdown();
-    }
+  {
+    char *msg;
+
+    GNUNET_asprintf (&msg,
+                     "%s",
+                     _ ("Failed to request a list of services: %s\n"));
+    fprintf (stdout,
+             msg,
+             req_string (rs));
+    GNUNET_free (msg);
+    ret = 3;
+    GNUNET_SCHEDULER_shutdown ();
+  }
   if (NULL == list)
-    {
-      fprintf(stderr,
-              "%s",
-              _("Error communicating with ARM. ARM not running?\n"));
-      GNUNET_SCHEDULER_shutdown();
-      ret = 3;
-      return;
-    }
+  {
+    fprintf (stderr,
+             "%s",
+             _ ("Error communicating with ARM. ARM not running?\n"));
+    GNUNET_SCHEDULER_shutdown ();
+    ret = 3;
+    return;
+  }
   for (unsigned int i = 0; i < count; i++)
   {
     switch (list[i].status)
     {
-      case GNUNET_ARM_SERVICE_STATUS_STOPPED:
-        num_stopped++;
-        break;
-      case GNUNET_ARM_SERVICE_STATUS_FAILED:
-        num_failed++;
-        break;
-      case GNUNET_ARM_SERVICE_STATUS_FINISHED:
-        num_finished++;
-        break;
-      case GNUNET_ARM_SERVICE_STATUS_STARTED:
-        num_started++;
-        break;
-      case GNUNET_ARM_SERVICE_STATUS_STOPPING:
-        num_stopping++;
-        fprintf(stdout, "%s (binary='%s', status=stopping)\n", list[i].name, 
list[i].binary);
-        break;
-      default:
-        GNUNET_break_op (0);
-        fprintf(stdout, "%s (binary='%s', status=unknown)\n", list[i].name, 
list[i].binary);
-        break;
+    case GNUNET_ARM_SERVICE_STATUS_STOPPED:
+      num_stopped++;
+      break;
+    case GNUNET_ARM_SERVICE_STATUS_FAILED:
+      num_failed++;
+      break;
+    case GNUNET_ARM_SERVICE_STATUS_FINISHED:
+      num_finished++;
+      break;
+    case GNUNET_ARM_SERVICE_STATUS_STARTED:
+      num_started++;
+      break;
+    case GNUNET_ARM_SERVICE_STATUS_STOPPING:
+      num_stopping++;
+      fprintf (stdout,
+               "%s (binary='%s', status=stopping)\n",
+               list[i].name,
+               list[i].binary);
+      break;
+    default:
+      GNUNET_break_op (0);
+      fprintf (stdout,
+               "%s (binary='%s', status=unknown)\n",
+               list[i].name,
+               list[i].binary);
+      break;
     }
   }
-  if (!quiet)
+  if (! quiet)
   {
     if (show_all)
-      fprintf(stdout, "%s", _("All services:\n"));
+      fprintf (stdout,
+               "%s",
+               _ ("All services:\n"));
     else
-      fprintf(stdout, "%s", _("Services (excluding stopped services):\n"));
-    if (num_stopped || num_failed || num_finished || num_stopping || 
num_started)
+      fprintf (stdout,
+               "%s",
+               _ ("Services (excluding stopped services):\n"));
+    if (num_stopped || num_failed || num_finished || num_stopping ||
+        num_started)
     {
       int sep = 0;
-      fprintf(stdout, "(");
+      fprintf (stdout, "(");
       if (0 != num_started)
       {
         if (sep)
-          fprintf(stdout, " / ");
-        fprintf(stdout, "started: %u", num_started);
+          fprintf (stdout, " / ");
+        fprintf (stdout,
+                 "started: %u",
+                 num_started);
         sep = 1;
       }
       if (0 != num_failed)
       {
         if (sep)
-          fprintf(stdout, " / ");
-        fprintf(stdout, "failed: %u", num_failed);
+          fprintf (stdout, " / ");
+        fprintf (stdout,
+                 "failed: %u",
+                 num_failed);
         sep = 1;
       }
       if (0 != num_stopping)
       {
         if (sep)
-          fprintf(stdout, " / ");
-        fprintf(stdout, "stopping: %u", num_stopping);
+          fprintf (stdout, " / ");
+        fprintf (stdout,
+                 "stopping: %u",
+                 num_stopping);
         sep = 1;
       }
       if (0 != num_stopped)
       {
         if (sep)
-          fprintf(stdout, " / ");
-        fprintf(stdout, "stopped: %u", num_stopped);
+          fprintf (stdout, " / ");
+        fprintf (stdout,
+                 "stopped: %u",
+                 num_stopped);
         sep = 1;
       }
       if (0 != num_finished)
       {
         if (sep)
-          fprintf(stdout, " / ");
-        fprintf(stdout, "finished: %u", num_finished);
+          fprintf (stdout, " / ");
+        fprintf (stdout,
+                 "finished: %u",
+                 num_finished);
         sep = 1;
       }
-      fprintf(stdout, ")\n");
+      fprintf (stdout, ")\n");
     }
     else
     {
-      fprintf(stdout, "%s", _("(No services configured.)\n"));
+      fprintf (stdout,
+               "%s",
+               _ ("(No services configured.)\n"));
     }
   }
   for (unsigned int i = 0; i < count; i++)
@@ -632,34 +669,52 @@ list_callback(void *cls,
     struct GNUNET_TIME_Relative restart_in;
     switch (list[i].status)
     {
-      case GNUNET_ARM_SERVICE_STATUS_STOPPED:
-        if (show_all)
-          fprintf(stdout, "%s (binary='%s', status=stopped)\n", list[i].name, 
list[i].binary);
-        break;
-      case GNUNET_ARM_SERVICE_STATUS_FAILED:
-        restart_in = GNUNET_TIME_absolute_get_remaining (list[i].restart_at);
-        fprintf(stdout, "%s (binary='%s', status=failed, exit_status=%d, 
restart_delay='%s')\n",
-                list[i].name,
-                list[i].binary,
-                list[i].last_exit_status,
-                GNUNET_STRINGS_relative_time_to_string (restart_in, 
GNUNET_YES));
-        break;
-      case GNUNET_ARM_SERVICE_STATUS_FINISHED:
-        fprintf(stdout, "%s (binary='%s', status=finished)\n", list[i].name, 
list[i].binary);
-        break;
-      case GNUNET_ARM_SERVICE_STATUS_STARTED:
-        fprintf(stdout, "%s (binary='%s', status=started)\n", list[i].name, 
list[i].binary);
-        break;
-      case GNUNET_ARM_SERVICE_STATUS_STOPPING:
-        fprintf(stdout, "%s (binary='%s', status=stopping)\n", list[i].name, 
list[i].binary);
-        break;
-      default:
-        GNUNET_break_op (0);
-        fprintf(stdout, "%s (binary='%s', status=unknown)\n", list[i].name, 
list[i].binary);
-        break;
+    case GNUNET_ARM_SERVICE_STATUS_STOPPED:
+      if (show_all)
+        fprintf (stdout,
+                 "%s (binary='%s', status=stopped)\n",
+                 list[i].name,
+                 list[i].binary);
+      break;
+    case GNUNET_ARM_SERVICE_STATUS_FAILED:
+      restart_in = GNUNET_TIME_absolute_get_remaining (list[i].restart_at);
+      fprintf (stdout,
+               "%s (binary='%s', status=failed, exit_status=%d, 
restart_delay='%s')\n",
+               list[i].name,
+               list[i].binary,
+               list[i].last_exit_status,
+               GNUNET_STRINGS_relative_time_to_string (restart_in,
+                                                       GNUNET_YES));
+      break;
+    case GNUNET_ARM_SERVICE_STATUS_FINISHED:
+      fprintf (stdout,
+               "%s (binary='%s', status=finished)\n",
+               list[i].name,
+               list[i].binary);
+      break;
+    case GNUNET_ARM_SERVICE_STATUS_STARTED:
+      fprintf (stdout,
+               "%s (binary='%s', status=started)\n",
+               list[i].name,
+               list[i].binary);
+      break;
+    case GNUNET_ARM_SERVICE_STATUS_STOPPING:
+      fprintf (stdout,
+               "%s (binary='%s', status=stopping)\n",
+               list[i].name,
+               list[i].binary);
+      break;
+    default:
+      GNUNET_break_op (0);
+      fprintf (stdout,
+               "%s (binary='%s', status=unknown)\n",
+               list[i].name,
+               list[i].binary);
+      break;
     }
   }
-  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
+  al_task = GNUNET_SCHEDULER_add_now (&action_loop,
+                                      NULL);
 }
 
 
@@ -670,91 +725,115 @@ list_callback(void *cls,
  * @param cls closure, unused
  */
 static void
-action_loop(void *cls)
+action_loop (void *cls)
 {
-  (void)cls;
+  (void) cls;
   al_task = NULL;
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Running requested actions\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Running requested actions\n");
   while (1)
+  {
+    switch (phase++)
     {
-      switch (phase++)
+    case 0:
+      if (NULL != term)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "Termination action\n");
+        op = GNUNET_ARM_request_service_stop (h,
+                                              term,
+                                              &term_callback,
+                                              NULL);
+        return;
+      }
+      break;
+
+    case 1:
+      if (end || restart)
+      {
+        if (GNUNET_YES !=
+            GNUNET_CLIENT_test (cfg,
+                                "arm"))
         {
-        case 0:
-          if (NULL != term)
-            {
-              GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Termination action\n");
-              op = GNUNET_ARM_request_service_stop(h, term, &term_callback, 
NULL);
-              return;
-            }
-          break;
-
-        case 1:
-          if (end || restart)
-            {
-              GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "End action\n");
-              op = GNUNET_ARM_request_service_stop(h, "arm", &stop_callback, 
NULL);
-              return;
-            }
-          break;
-
-        case 2:
-          if (start)
-            {
-              GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Start action\n");
-              op =
-                GNUNET_ARM_request_service_start(h,
-                                                 "arm",
-                                                 (no_stdout
-                                                  ? 0
-                                                  : GNUNET_OS_INHERIT_STD_OUT) 
|
-                                                 (no_stderr
-                                                  ? 0
-                                                  : GNUNET_OS_INHERIT_STD_ERR),
-                                                 &start_callback,
-                                                 NULL);
-              return;
-            }
-          break;
-
-        case 3:
-          if (NULL != init)
-            {
-              GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Initialization action\n");
-              op = GNUNET_ARM_request_service_start(h,
-                                                    init,
-                                                    GNUNET_OS_INHERIT_STD_NONE,
-                                                    &init_callback,
-                                                    NULL);
-              return;
-            }
-          break;
-
-        case 4:
-          if (list)
-            {
-              GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-                         "Going to list all running services controlled by 
ARM.\n");
-              op = GNUNET_ARM_request_service_list(h, &list_callback, &list);
-              return;
-            }
-          break;
-
-        case 5:
-          if (monitor)
-            {
-              if (!quiet)
-                fprintf(stderr, _("Now only monitoring, press CTRL-C to 
stop.\n"));
-              quiet =
-                0; /* does not make sense to stay quiet in monitor mode at 
this time */
-              return; /* done with tasks, just monitor */
-            }
-          break;
-
-        default: /* last phase */
-          GNUNET_SCHEDULER_shutdown();
+          GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                      "GNUnet not running, cannot stop the peer\n");
+        }
+        else
+        {
+          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                      "End action\n");
+          op = GNUNET_ARM_request_service_stop (h,
+                                                "arm",
+                                                &stop_callback,
+                                                NULL);
           return;
         }
+      }
+      break;
+
+    case 2:
+      if (start)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "Start action\n");
+        op =
+          GNUNET_ARM_request_service_start (h,
+                                            "arm",
+                                            (no_stdout
+                                             ? 0
+                                             : GNUNET_OS_INHERIT_STD_OUT)
+                                            | (no_stderr
+                                               ? 0
+                                               : GNUNET_OS_INHERIT_STD_ERR),
+                                            &start_callback,
+                                            NULL);
+        return;
+      }
+      break;
+
+    case 3:
+      if (NULL != init)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "Initialization action\n");
+        op = GNUNET_ARM_request_service_start (h,
+                                               init,
+                                               GNUNET_OS_INHERIT_STD_NONE,
+                                               &init_callback,
+                                               NULL);
+        return;
+      }
+      break;
+
+    case 4:
+      if (list)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                    "Going to list all running services controlled by ARM.\n");
+        op = GNUNET_ARM_request_service_list (h,
+                                              &list_callback,
+                                              &list);
+        return;
+      }
+      break;
+
+    case 5:
+      if (monitor)
+      {
+        if (! quiet)
+          fprintf (stderr,
+                   _ ("Now only monitoring, press CTRL-C to stop.\n"));
+        quiet =
+          0;       /* does not make sense to stay quiet in monitor mode at 
this time */
+        return;       /* done with tasks, just monitor */
+      }
+      break;
+
+    default:     /* last phase */
+      GNUNET_SCHEDULER_shutdown ();
+      return;
     }
+  }
 }
 
 
@@ -766,48 +845,50 @@ action_loop(void *cls)
  * @param status status of the service
  */
 static void
-srv_status(void *cls,
-           const char *service,
-           enum GNUNET_ARM_ServiceMonitorStatus status)
+srv_status (void *cls,
+            const char *service,
+            enum GNUNET_ARM_ServiceMonitorStatus status)
 {
   const char *msg;
 
-  (void)cls;
+  (void) cls;
   switch (status)
-    {
-    case GNUNET_ARM_SERVICE_MONITORING_STARTED:
-      return; /* this should be done silently */
+  {
+  case GNUNET_ARM_SERVICE_MONITORING_STARTED:
+    return;   /* this should be done silently */
 
-    case GNUNET_ARM_SERVICE_STOPPED:
-      msg = _("Stopped %s.\n");
-      break;
+  case GNUNET_ARM_SERVICE_STOPPED:
+    msg = _ ("Stopped %s.\n");
+    break;
 
-    case GNUNET_ARM_SERVICE_STARTING:
-      msg = _("Starting %s...\n");
-      break;
+  case GNUNET_ARM_SERVICE_STARTING:
+    msg = _ ("Starting %s...\n");
+    break;
 
-    case GNUNET_ARM_SERVICE_STOPPING:
-      msg = _("Stopping %s...\n");
-      break;
+  case GNUNET_ARM_SERVICE_STOPPING:
+    msg = _ ("Stopping %s...\n");
+    break;
 
-    default:
-      msg = NULL;
-      break;
-    }
-  if (!quiet)
-    {
-      if (NULL != msg)
-        fprintf(stderr, msg, service);
-      else
-        fprintf(stderr,
-                _("Unknown status %u for service %s.\n"),
-                status,
-                service);
-    }
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-             "Got service %s status %d\n",
-             service,
-             (int)status);
+  default:
+    msg = NULL;
+    break;
+  }
+  if (! quiet)
+  {
+    if (NULL != msg)
+      fprintf (stderr,
+               msg,
+               service);
+    else
+      fprintf (stderr,
+               _ ("Unknown status %u for service %s.\n"),
+               status,
+               service);
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Got service %s status %d\n",
+              service,
+              (int) status);
 }
 
 
@@ -815,12 +896,12 @@ srv_status(void *cls,
  * Task run on timeout (if -T is given).
  */
 static void
-timeout_task_cb(void *cls)
+timeout_task_cb (void *cls)
 {
-  (void)cls;
+  (void) cls;
   timeout_task = NULL;
   ret = 2;
-  GNUNET_SCHEDULER_shutdown();
+  GNUNET_SCHEDULER_shutdown ();
 }
 
 
@@ -833,34 +914,47 @@ timeout_task_cb(void *cls)
  * @param c configuration
  */
 static void
-run(void *cls,
-    char *const *args,
-    const char *cfgfile,
-    const struct GNUNET_CONFIGURATION_Handle *c)
+run (void *cls,
+     char *const *args,
+     const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *c)
 {
-  (void)cls;
-  (void)args;
-  (void)cfgfile;
-  cfg = GNUNET_CONFIGURATION_dup(c);
+  (void) cls;
+  (void) args;
+  (void) cfgfile;
+  cfg = GNUNET_CONFIGURATION_dup (c);
   if (GNUNET_OK !=
-      GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_HOME", &dir))
-    {
-      GNUNET_log_config_missing(GNUNET_ERROR_TYPE_ERROR, "PATHS", 
"GNUNET_HOME");
-      return;
-    }
-  (void)GNUNET_CONFIGURATION_get_value_filename(cfg,
-                                                "arm",
-                                                "CONFIG",
-                                                &config_file);
-  if (NULL == (h = GNUNET_ARM_connect(cfg, &conn_status, NULL)))
+      GNUNET_CONFIGURATION_get_value_string (cfg,
+                                             "PATHS",
+                                             "GNUNET_HOME",
+                                             &dir))
+  {
+    GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+                               "PATHS",
+                               "GNUNET_HOME");
+    return;
+  }
+  (void) GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                                  "arm",
+                                                  "CONFIG",
+                                                  &config_file);
+  if (NULL == (h = GNUNET_ARM_connect (cfg,
+                                       &conn_status,
+                                       NULL)))
     return;
   if (monitor)
-    m = GNUNET_ARM_monitor_start(cfg, &srv_status, NULL);
-  al_task = GNUNET_SCHEDULER_add_now(&action_loop, NULL);
-  GNUNET_SCHEDULER_add_shutdown(&shutdown_task, NULL);
+    m = GNUNET_ARM_monitor_start (cfg,
+                                  &srv_status,
+                                  NULL);
+  al_task = GNUNET_SCHEDULER_add_now (&action_loop,
+                                      NULL);
+  GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+                                 NULL);
   if (0 != timeout.rel_value_us)
     timeout_task =
-      GNUNET_SCHEDULER_add_delayed(timeout, &timeout_task_cb, NULL);
+      GNUNET_SCHEDULER_add_delayed (timeout,
+                                    &timeout_task_cb,
+                                    NULL);
 }
 
 
@@ -872,92 +966,98 @@ run(void *cls,
  * @return 0 ok, 1 on error, 2 on timeout
  */
 int
-main(int argc, char *const *argv)
+main (int argc, char *const *argv)
 {
-  struct GNUNET_GETOPT_CommandLineOption options[] =
-  { GNUNET_GETOPT_option_flag('e',
-                              "end",
-                              gettext_noop("stop all GNUnet services"),
-                              &end),
-    GNUNET_GETOPT_option_string('i',
-                                "init",
-                                "SERVICE",
-                                gettext_noop("start a particular service"),
-                                &init),
-    GNUNET_GETOPT_option_string('k',
-                                "kill",
-                                "SERVICE",
-                                gettext_noop("stop a particular service"),
-                                &term),
-    GNUNET_GETOPT_option_flag('a',
-                              "all",
-                              gettext_noop("also show stopped services (used 
with -I)"),
-                              &show_all),
-    GNUNET_GETOPT_option_flag('s',
-                              "start",
-                              gettext_noop(
-                                "start all GNUnet default services"),
-                              &start),
-    GNUNET_GETOPT_option_flag('r',
-                              "restart",
-                              gettext_noop(
-                                "stop and start all GNUnet default services"),
-                              &restart),
-    GNUNET_GETOPT_option_flag('d',
-                              "delete",
-                              gettext_noop(
-                                "delete config file and directory on exit"),
-                              &delete),
-    GNUNET_GETOPT_option_flag('m',
-                              "monitor",
-                              gettext_noop("monitor ARM activities"),
-                              &monitor),
-    GNUNET_GETOPT_option_flag('q',
-                              "quiet",
-                              gettext_noop("don't print status messages"),
-                              &quiet),
-    GNUNET_GETOPT_option_relative_time(
+  struct GNUNET_GETOPT_CommandLineOption options[] = {
+    GNUNET_GETOPT_option_flag ('e',
+                               "end",
+                               gettext_noop ("stop all GNUnet services"),
+                               &end),
+    GNUNET_GETOPT_option_string ('i',
+                                 "init",
+                                 "SERVICE",
+                                 gettext_noop ("start a particular service"),
+                                 &init),
+    GNUNET_GETOPT_option_string ('k',
+                                 "kill",
+                                 "SERVICE",
+                                 gettext_noop ("stop a particular service"),
+                                 &term),
+    GNUNET_GETOPT_option_flag ('a',
+                               "all",
+                               gettext_noop (
+                                 "also show stopped services (used with -I)"),
+                               &show_all),
+    GNUNET_GETOPT_option_flag ('s',
+                               "start",
+                               gettext_noop (
+                                 "start all GNUnet default services"),
+                               &start),
+    GNUNET_GETOPT_option_flag ('r',
+                               "restart",
+                               gettext_noop (
+                                 "stop and start all GNUnet default services"),
+                               &restart),
+    GNUNET_GETOPT_option_flag ('d',
+                               "delete",
+                               gettext_noop (
+                                 "delete config file and directory on exit"),
+                               &delete),
+    GNUNET_GETOPT_option_flag ('m',
+                               "monitor",
+                               gettext_noop ("monitor ARM activities"),
+                               &monitor),
+    GNUNET_GETOPT_option_flag ('q',
+                               "quiet",
+                               gettext_noop ("don't print status messages"),
+                               &quiet),
+    GNUNET_GETOPT_option_relative_time (
       'T',
       "timeout",
       "DELAY",
-      gettext_noop(
+      gettext_noop (
         "exit with error status if operation does not finish after DELAY"),
       &timeout),
-    GNUNET_GETOPT_option_flag('I',
-                              "info",
-                              gettext_noop(
-                                "list currently running services"),
-                              &list),
-    GNUNET_GETOPT_option_flag(
+    GNUNET_GETOPT_option_flag ('I',
+                               "info",
+                               gettext_noop (
+                                 "list currently running services"),
+                               &list),
+    GNUNET_GETOPT_option_flag (
       'O',
       "no-stdout",
-      gettext_noop("don't let gnunet-service-arm inherit standard output"),
+      gettext_noop ("don't let gnunet-service-arm inherit standard output"),
       &no_stdout),
-    GNUNET_GETOPT_option_flag(
+    GNUNET_GETOPT_option_flag (
       'E',
       "no-stderr",
-      gettext_noop("don't let gnunet-service-arm inherit standard error"),
+      gettext_noop ("don't let gnunet-service-arm inherit standard error"),
       &no_stderr),
-    GNUNET_GETOPT_OPTION_END };
+    GNUNET_GETOPT_OPTION_END
+  };
   int lret;
 
-  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args(argc, argv, &argc, &argv))
+  if (GNUNET_OK !=
+      GNUNET_STRINGS_get_utf8_args (argc,
+                                    argv,
+                                    &argc,
+                                    &argv))
     return 2;
   if (GNUNET_OK ==
-      (lret = GNUNET_PROGRAM_run(
+      (lret = GNUNET_PROGRAM_run (
          argc,
          argv,
          "gnunet-arm",
-         gettext_noop(
+         gettext_noop (
            "Control services and the Automated Restart Manager (ARM)"),
          options,
          &run,
          NULL)))
-    {
-      GNUNET_free((void *)argv);
-      return ret;
-    }
-  GNUNET_free((void *)argv);
+  {
+    GNUNET_free ((void *) argv);
+    return ret;
+  }
+  GNUNET_free ((void *) argv);
   return lret;
 }
 
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c
index 352ccce04..1ddcbf090 100644
--- a/src/gns/gnunet-gns.c
+++ b/src/gns/gnunet-gns.c
@@ -90,24 +90,24 @@ static int global_ret;
  * @param cls unused
  */
 static void
-do_shutdown(void *cls)
+do_shutdown (void *cls)
 {
-  (void)cls;
+  (void) cls;
   if (NULL != to_task)
-    {
-      GNUNET_SCHEDULER_cancel(to_task);
-      to_task = NULL;
-    }
+  {
+    GNUNET_SCHEDULER_cancel (to_task);
+    to_task = NULL;
+  }
   if (NULL != lr)
-    {
-      GNUNET_GNS_lookup_with_tld_cancel(lr);
-      lr = NULL;
-    }
+  {
+    GNUNET_GNS_lookup_with_tld_cancel (lr);
+    lr = NULL;
+  }
   if (NULL != gns)
-    {
-      GNUNET_GNS_disconnect(gns);
-      gns = NULL;
-    }
+  {
+    GNUNET_GNS_disconnect (gns);
+    gns = NULL;
+  }
 }
 
 /**
@@ -116,11 +116,11 @@ do_shutdown(void *cls)
  * @param cls unused
  */
 static void
-do_timeout(void* cls)
+do_timeout (void*cls)
 {
   to_task = NULL;
-  global_ret = 3; //Timeout
-  GNUNET_SCHEDULER_shutdown();
+  global_ret = 3; // Timeout
+  GNUNET_SCHEDULER_shutdown ();
 }
 
 /**
@@ -132,10 +132,10 @@ do_timeout(void* cls)
  * @param rd array of @a rd_count records with the results
  */
 static void
-process_lookup_result(void *cls,
-                      int was_gns,
-                      uint32_t rd_count,
-                      const struct GNUNET_GNSRECORD_Data *rd)
+process_lookup_result (void *cls,
+                       int was_gns,
+                       uint32_t rd_count,
+                       const struct GNUNET_GNSRECORD_Data *rd)
 {
   const char *name = cls;
   const char *typename;
@@ -143,41 +143,41 @@ process_lookup_result(void *cls,
 
   lr = NULL;
   if (GNUNET_NO == was_gns)
-    {
-      global_ret = 4; /* not for GNS */
-      GNUNET_SCHEDULER_shutdown();
-      return;
-    }
-  if (!raw)
-    {
-      if (0 == rd_count)
-        printf("No results.\n");
-      else
-        printf("%s:\n", name);
-    }
+  {
+    global_ret = 4;   /* not for GNS */
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
+  if (! raw)
+  {
+    if (0 == rd_count)
+      printf ("No results.\n");
+    else
+      printf ("%s:\n", name);
+  }
   for (uint32_t i = 0; i < rd_count; i++)
+  {
+    if ((rd[i].record_type != rtype) && (GNUNET_GNSRECORD_TYPE_ANY != rtype))
+      continue;
+    typename = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
+    string_val = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
+                                                   rd[i].data,
+                                                   rd[i].data_size);
+    if (NULL == string_val)
     {
-      if ((rd[i].record_type != rtype) && (GNUNET_GNSRECORD_TYPE_ANY != rtype))
-        continue;
-      typename = GNUNET_GNSRECORD_number_to_typename(rd[i].record_type);
-      string_val = GNUNET_GNSRECORD_value_to_string(rd[i].record_type,
-                                                    rd[i].data,
-                                                    rd[i].data_size);
-      if (NULL == string_val)
-        {
-          fprintf(stderr,
-                  "Record %u of type %d malformed, skipping\n",
-                  (unsigned int)i,
-                  (int)rd[i].record_type);
-          continue;
-        }
-      if (raw)
-        printf("%s\n", string_val);
-      else
-        printf("Got `%s' record: %s\n", typename, string_val);
-      GNUNET_free(string_val);
+      fprintf (stderr,
+               "Record %u of type %d malformed, skipping\n",
+               (unsigned int) i,
+               (int) rd[i].record_type);
+      continue;
     }
-  GNUNET_SCHEDULER_shutdown();
+    if (raw)
+      printf ("%s\n", string_val);
+    else
+      printf ("Got `%s' record: %s\n", typename, string_val);
+    GNUNET_free (string_val);
+  }
+  GNUNET_SCHEDULER_shutdown ();
 }
 
 
@@ -190,53 +190,69 @@ process_lookup_result(void *cls,
  * @param c configuration
  */
 static void
-run(void *cls,
-    char *const *args,
-    const char *cfgfile,
-    const struct GNUNET_CONFIGURATION_Handle *c)
+run (void *cls,
+     char *const *args,
+     const char *cfgfile,
+     const struct GNUNET_CONFIGURATION_Handle *c)
 {
-  (void)cls;
-  (void)args;
-  (void)cfgfile;
+  (void) cls;
+  (void) args;
+  (void) cfgfile;
 
   cfg = c;
   to_task = NULL;
-  if (GNUNET_OK != GNUNET_DNSPARSER_check_name(lookup_name))
-    {
-      fprintf(stderr, _("`%s' is not a valid domain name\n"), lookup_name);
-      global_ret = 3;
-      return;
-    }
-  to_task = GNUNET_SCHEDULER_add_delayed(timeout, &do_timeout, NULL);
-  gns = GNUNET_GNS_connect(cfg);
+  if (GNUNET_OK != GNUNET_DNSPARSER_check_name (lookup_name))
+  {
+    fprintf (stderr,
+             _ ("`%s' is not a valid domain name\n"),
+             lookup_name);
+    global_ret = 3;
+    return;
+  }
+  if (GNUNET_YES !=
+      GNUNET_CLIENT_test (cfg,
+                          "arm"))
+  {
+    fprintf (stderr,
+             _ ("GNUnet not running\n"));
+    global_ret = 2;
+    return;
+  }
+  to_task = GNUNET_SCHEDULER_add_delayed (timeout,
+                                          &do_timeout,
+                                          NULL);
+  gns = GNUNET_GNS_connect (cfg);
   if (NULL == gns)
-    {
-      fprintf(stderr, _("Failed to connect to GNS\n"));
-      global_ret = 2;
-      return;
-    }
-  GNUNET_SCHEDULER_add_shutdown(&do_shutdown, NULL);
+  {
+    fprintf (stderr,
+             _ ("Failed to connect to GNS\n"));
+    global_ret = 2;
+    return;
+  }
+  GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+                                 NULL);
   if (NULL != lookup_type)
-    rtype = GNUNET_GNSRECORD_typename_to_number(lookup_type);
+    rtype = GNUNET_GNSRECORD_typename_to_number (lookup_type);
   else
     rtype = GNUNET_DNSPARSER_TYPE_A;
   if (UINT32_MAX == rtype)
-    {
-      fprintf(stderr, _("Invalid typename specified, assuming `ANY'\n"));
-      rtype = GNUNET_GNSRECORD_TYPE_ANY;
-    }
-  lr = GNUNET_GNS_lookup_with_tld(gns,
-                                  lookup_name,
-                                  rtype,
-                                  GNUNET_GNS_LO_DEFAULT,
-                                  &process_lookup_result,
-                                  lookup_name);
+  {
+    fprintf (stderr,
+             _ ("Invalid typename specified, assuming `ANY'\n"));
+    rtype = GNUNET_GNSRECORD_TYPE_ANY;
+  }
+  lr = GNUNET_GNS_lookup_with_tld (gns,
+                                   lookup_name,
+                                   rtype,
+                                   GNUNET_GNS_LO_DEFAULT,
+                                   &process_lookup_result,
+                                   lookup_name);
   if (NULL == lr)
-    {
-      global_ret = 2;
-      GNUNET_SCHEDULER_shutdown();
-      return;
-    }
+  {
+    global_ret = 2;
+    GNUNET_SCHEDULER_shutdown ();
+    return;
+  }
 }
 
 
@@ -248,48 +264,50 @@ run(void *cls,
  * @return 0 ok, 1 on error
  */
 int
-main(int argc, char *const *argv)
+main (int argc, char *const *argv)
 {
   timeout = GNUNET_TIME_UNIT_FOREVER_REL;
   struct GNUNET_GETOPT_CommandLineOption options[] =
-  { GNUNET_GETOPT_option_mandatory(
-      GNUNET_GETOPT_option_string('u',
-                                  "lookup",
-                                  "NAME",
-                                  gettext_noop(
-                                    "Lookup a record for the given name"),
-                                  &lookup_name)),
-    GNUNET_GETOPT_option_string('t',
-                                "type",
-                                "TYPE",
-                                gettext_noop(
-                                  "Specify the type of the record to lookup"),
-                                &lookup_type),
-    GNUNET_GETOPT_option_relative_time('T',
-                                       "timeout",
-                                       "TIMEOUT",
-                                       gettext_noop(
-                                         "Specify a timeout for the lookup"),
-                                       &timeout),
-    GNUNET_GETOPT_option_flag('r',
-                              "raw",
-                              gettext_noop("No unneeded output"),
-                              &raw),
+  { GNUNET_GETOPT_option_mandatory (
+      GNUNET_GETOPT_option_string ('u',
+                                   "lookup",
+                                   "NAME",
+                                   gettext_noop (
+                                     "Lookup a record for the given name"),
+                                   &lookup_name)),
+    GNUNET_GETOPT_option_string ('t',
+                                 "type",
+                                 "TYPE",
+                                 gettext_noop (
+                                   "Specify the type of the record to lookup"),
+                                 &lookup_type),
+    GNUNET_GETOPT_option_relative_time ('T',
+                                        "timeout",
+                                        "TIMEOUT",
+                                        gettext_noop (
+                                          "Specify a timeout for the lookup"),
+                                        &timeout),
+    GNUNET_GETOPT_option_flag ('r',
+                               "raw",
+                               gettext_noop ("No unneeded output"),
+                               &raw),
     GNUNET_GETOPT_OPTION_END };
   int ret;
 
-  if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args(argc, argv, &argc, &argv))
+  if (GNUNET_OK !=
+      GNUNET_STRINGS_get_utf8_args (argc, argv,
+                                    &argc, &argv))
     return 2;
 
-  GNUNET_log_setup("gnunet-gns", "WARNING", NULL);
-  ret = GNUNET_PROGRAM_run(argc,
-                           argv,
-                           "gnunet-gns",
-                           _("GNUnet GNS resolver tool"),
-                           options,
-                           &run,
-                           NULL);
-  GNUNET_free((void *)argv);
+  GNUNET_log_setup ("gnunet-gns", "WARNING", NULL);
+  ret = GNUNET_PROGRAM_run (argc,
+                            argv,
+                            "gnunet-gns",
+                            _ ("GNUnet GNS resolver tool"),
+                            options,
+                            &run,
+                            NULL);
+  GNUNET_free ((void *) argv);
   if (GNUNET_OK != ret)
     return 1;
   return global_ret;
diff --git a/src/include/gnunet_client_lib.h b/src/include/gnunet_client_lib.h
index 8e4984124..9fc52724c 100644
--- a/src/include/gnunet_client_lib.h
+++ b/src/include/gnunet_client_lib.h
@@ -46,6 +46,23 @@ extern "C"
 #include "gnunet_mq_lib.h"
 
 
+/**
+ * Test if the port or UNIXPATH of the given @a service_name
+ * is in use and thus (most likely) the respective service is up.
+ *
+ * @param cfg our configuration
+ * @param service_name name of the service to connect to
+ * @return #GNUNET_YES if the service is (likely) up (or running remotely),
+ *         #GNUNET_NO if the service is (definitively) down,
+ *         #GNUNET_SYSERR if the configuration does not give us
+ *          the necessary information about the service, or if
+ *          we could not check (i.e. socket() failed)
+ */
+int
+GNUNET_CLIENT_test (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                    const char *service_name);
+
+
 /**
  * Create a message queue to connect to a GNUnet service.
  * If handlers are specfied, receive messages from the connection.
@@ -57,11 +74,11 @@ extern "C"
  * @return the message queue, NULL on error
  */
 struct GNUNET_MQ_Handle *
-GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg,
-                      const char *service_name,
-                      const struct GNUNET_MQ_MessageHandler *handlers,
-                      GNUNET_MQ_ErrorHandler error_handler,
-                      void *error_handler_cls);
+GNUNET_CLIENT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                       const char *service_name,
+                       const struct GNUNET_MQ_MessageHandler *handlers,
+                       GNUNET_MQ_ErrorHandler error_handler,
+                       void *error_handler_cls);
 
 
 #if 0                           /* keep Emacsens' auto-indent happy */
diff --git a/src/util/client.c b/src/util/client.c
index e3585af2e..d431909cf 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2001-2016 GNUnet e.V.
+     Copyright (C) 2001-2016, 2019 GNUnet e.V.
 
      GNUnet is free software: you can redistribute it and/or modify it
      under the terms of the GNU Affero General Public License as published
@@ -33,7 +33,7 @@
 #include "gnunet_socks.h"
 
 
-#define LOG(kind, ...) GNUNET_log_from(kind, "util-client", __VA_ARGS__)
+#define LOG(kind, ...) GNUNET_log_from (kind, "util-client", __VA_ARGS__)
 
 /**
  * Timeout we use on TCP connect before trying another
@@ -41,7 +41,8 @@
  * is this value divided by the number of address families.
  * Default is 5s.
  */
-#define CONNECT_RETRY_TIMEOUT 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
+#define CONNECT_RETRY_TIMEOUT GNUNET_TIME_relative_multiply ( \
+    GNUNET_TIME_UNIT_SECONDS, 5)
 
 
 
@@ -55,7 +56,8 @@ struct ClientState;
  * During connect, we try multiple possible IP addresses
  * to find out which one might work.
  */
-struct AddressProbe {
+struct AddressProbe
+{
   /**
    * This is a linked list.
    */
@@ -96,7 +98,8 @@ struct AddressProbe {
 /**
  * Internal state for a client connected to a GNUnet service.
  */
-struct ClientState {
+struct ClientState
+{
   /**
    * The connection handle, NULL if not live
    */
@@ -205,7 +208,7 @@ struct ClientState {
  * @param cls the `struct ClientState` to try to connect to the service
  */
 static void
-start_connect(void *cls);
+start_connect (void *cls);
 
 
 /**
@@ -215,26 +218,26 @@ start_connect(void *cls);
  * @param cstate the connection we tried to establish
  */
 static void
-connect_fail_continuation(struct ClientState *cstate)
+connect_fail_continuation (struct ClientState *cstate)
 {
-  GNUNET_break(NULL == cstate->ap_head);
-  GNUNET_break(NULL == cstate->ap_tail);
-  GNUNET_break(NULL == cstate->dns_active);
-  GNUNET_break(NULL == cstate->sock);
-  GNUNET_assert(NULL == cstate->send_task);
-  GNUNET_assert(NULL == cstate->recv_task);
+  GNUNET_break (NULL == cstate->ap_head);
+  GNUNET_break (NULL == cstate->ap_tail);
+  GNUNET_break (NULL == cstate->dns_active);
+  GNUNET_break (NULL == cstate->sock);
+  GNUNET_assert (NULL == cstate->send_task);
+  GNUNET_assert (NULL == cstate->recv_task);
   // GNUNET_assert (NULL == cstate->proxy_handshake);
 
-  cstate->back_off = GNUNET_TIME_STD_BACKOFF(cstate->back_off);
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "Failed to establish connection to `%s', no further addresses to try, 
will try again in %s.\n",
-      cstate->service_name,
-      GNUNET_STRINGS_relative_time_to_string(cstate->back_off,
-                                             GNUNET_YES));
+  cstate->back_off = GNUNET_TIME_STD_BACKOFF (cstate->back_off);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Failed to establish connection to `%s', no further addresses to try, 
will try again in %s.\n",
+       cstate->service_name,
+       GNUNET_STRINGS_relative_time_to_string (cstate->back_off,
+                                               GNUNET_YES));
   cstate->retry_task
-    = GNUNET_SCHEDULER_add_delayed(cstate->back_off,
-                                   &start_connect,
-                                   cstate);
+    = GNUNET_SCHEDULER_add_delayed (cstate->back_off,
+                                    &start_connect,
+                                    cstate);
 }
 
 
@@ -244,7 +247,7 @@ connect_fail_continuation(struct ClientState *cstate)
  * @param cls the `struct ClientState` with the `msg` to transmit
  */
 static void
-transmit_ready(void *cls)
+transmit_ready (void *cls)
 {
   struct ClientState *cstate = cls;
   ssize_t ret;
@@ -255,56 +258,56 @@ transmit_ready(void *cls)
   cstate->send_task = NULL;
   if (GNUNET_YES == cstate->in_destroy)
     return;
-  pos = (const char *)cstate->msg;
-  len = ntohs(cstate->msg->size);
-  GNUNET_assert(cstate->msg_off < len);
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "message of type %u trying to send with socket %p (MQ: %p\n",
-      ntohs(cstate->msg->type),
-      cstate->sock,
-      cstate->mq);
+  pos = (const char *) cstate->msg;
+  len = ntohs (cstate->msg->size);
+  GNUNET_assert (cstate->msg_off < len);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "message of type %u trying to send with socket %p (MQ: %p\n",
+       ntohs (cstate->msg->type),
+       cstate->sock,
+       cstate->mq);
 
 RETRY:
-  ret = GNUNET_NETWORK_socket_send(cstate->sock,
-                                   &pos[cstate->msg_off],
-                                   len - cstate->msg_off);
+  ret = GNUNET_NETWORK_socket_send (cstate->sock,
+                                    &pos[cstate->msg_off],
+                                    len - cstate->msg_off);
   if (-1 == ret)
+  {
+    LOG (GNUNET_ERROR_TYPE_WARNING,
+         "Error during sending message of type %u\n",
+         ntohs (cstate->msg->type));
+    if (EINTR == errno)
     {
-      LOG(GNUNET_ERROR_TYPE_WARNING,
-          "Error during sending message of type %u\n",
-          ntohs(cstate->msg->type));
-      if (EINTR == errno)
-        {
-          LOG(GNUNET_ERROR_TYPE_DEBUG,
-              "Retrying message of type %u\n",
-              ntohs(cstate->msg->type));
-          goto RETRY;
-        }
-      GNUNET_MQ_inject_error(cstate->mq,
-                             GNUNET_MQ_ERROR_WRITE);
-      return;
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "Retrying message of type %u\n",
+           ntohs (cstate->msg->type));
+      goto RETRY;
     }
+    GNUNET_MQ_inject_error (cstate->mq,
+                            GNUNET_MQ_ERROR_WRITE);
+    return;
+  }
   notify_in_flight = (0 == cstate->msg_off);
   cstate->msg_off += ret;
   if (cstate->msg_off < len)
-    {
-      LOG(GNUNET_ERROR_TYPE_DEBUG,
-          "rescheduling message of type %u\n",
-          ntohs(cstate->msg->type));
-      cstate->send_task
-        = GNUNET_SCHEDULER_add_write_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                         cstate->sock,
-                                         &transmit_ready,
-                                         cstate);
-      if (notify_in_flight)
-        GNUNET_MQ_impl_send_in_flight(cstate->mq);
-      return;
-    }
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "sending message of type %u successful\n",
-      ntohs(cstate->msg->type));
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "rescheduling message of type %u\n",
+         ntohs (cstate->msg->type));
+    cstate->send_task
+      = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                        cstate->sock,
+                                        &transmit_ready,
+                                        cstate);
+    if (notify_in_flight)
+      GNUNET_MQ_impl_send_in_flight (cstate->mq);
+    return;
+  }
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "sending message of type %u successful\n",
+       ntohs (cstate->msg->type));
   cstate->msg = NULL;
-  GNUNET_MQ_impl_send_continue(cstate->mq);
+  GNUNET_MQ_impl_send_continue (cstate->mq);
 }
 
 
@@ -319,20 +322,20 @@ RETRY:
  *     #GNUNET_SYSERR to stop further processing due to error
  */
 static int
-recv_message(void *cls,
-             const struct GNUNET_MessageHeader *msg)
+recv_message (void *cls,
+              const struct GNUNET_MessageHeader *msg)
 {
   struct ClientState *cstate = cls;
 
   if (GNUNET_YES == cstate->in_destroy)
     return GNUNET_NO;
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "Received message of type %u and size %u from %s\n",
-      ntohs(msg->type),
-      ntohs(msg->size),
-      cstate->service_name);
-  GNUNET_MQ_inject_message(cstate->mq,
-                           msg);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Received message of type %u and size %u from %s\n",
+       ntohs (msg->type),
+       ntohs (msg->size),
+       cstate->service_name);
+  GNUNET_MQ_inject_message (cstate->mq,
+                            msg);
   if (GNUNET_YES == cstate->in_destroy)
     return GNUNET_NO;
   return GNUNET_OK;
@@ -345,20 +348,20 @@ recv_message(void *cls,
  * @param cstate handle of the client state to process
  */
 static void
-cancel_aps(struct ClientState *cstate)
+cancel_aps (struct ClientState *cstate)
 {
   struct AddressProbe *pos;
 
   while (NULL != (pos = cstate->ap_head))
-    {
-      GNUNET_break(GNUNET_OK ==
-                   GNUNET_NETWORK_socket_close(pos->sock));
-      GNUNET_SCHEDULER_cancel(pos->task);
-      GNUNET_CONTAINER_DLL_remove(cstate->ap_head,
-                                  cstate->ap_tail,
-                                  pos);
-      GNUNET_free(pos);
-    }
+  {
+    GNUNET_break (GNUNET_OK ==
+                  GNUNET_NETWORK_socket_close (pos->sock));
+    GNUNET_SCHEDULER_cancel (pos->task);
+    GNUNET_CONTAINER_DLL_remove (cstate->ap_head,
+                                 cstate->ap_tail,
+                                 pos);
+    GNUNET_free (pos);
+  }
 }
 
 
@@ -370,51 +373,51 @@ cancel_aps(struct ClientState *cstate)
  * @param impl_state our `struct ClientState`
  */
 static void
-connection_client_destroy_impl(struct GNUNET_MQ_Handle *mq,
-                               void *impl_state)
+connection_client_destroy_impl (struct GNUNET_MQ_Handle *mq,
+                                void *impl_state)
 {
   struct ClientState *cstate = impl_state;
 
-  (void)mq;
+  (void) mq;
   if (NULL != cstate->dns_active)
-    {
-      GNUNET_RESOLVER_request_cancel(cstate->dns_active);
-      cstate->dns_active = NULL;
-    }
+  {
+    GNUNET_RESOLVER_request_cancel (cstate->dns_active);
+    cstate->dns_active = NULL;
+  }
   if (NULL != cstate->send_task)
-    {
-      GNUNET_SCHEDULER_cancel(cstate->send_task);
-      cstate->send_task = NULL;
-    }
+  {
+    GNUNET_SCHEDULER_cancel (cstate->send_task);
+    cstate->send_task = NULL;
+  }
   if (NULL != cstate->retry_task)
-    {
-      GNUNET_SCHEDULER_cancel(cstate->retry_task);
-      cstate->retry_task = NULL;
-    }
+  {
+    GNUNET_SCHEDULER_cancel (cstate->retry_task);
+    cstate->retry_task = NULL;
+  }
   if (GNUNET_SYSERR == cstate->in_destroy)
-    {
-      /* defer destruction */
-      cstate->in_destroy = GNUNET_YES;
-      cstate->mq = NULL;
-      return;
-    }
+  {
+    /* defer destruction */
+    cstate->in_destroy = GNUNET_YES;
+    cstate->mq = NULL;
+    return;
+  }
   if (NULL != cstate->recv_task)
-    {
-      GNUNET_SCHEDULER_cancel(cstate->recv_task);
-      cstate->recv_task = NULL;
-    }
+  {
+    GNUNET_SCHEDULER_cancel (cstate->recv_task);
+    cstate->recv_task = NULL;
+  }
   if (NULL != cstate->sock)
-    {
-      LOG(GNUNET_ERROR_TYPE_DEBUG,
-          "destroying socket: %p\n",
-          cstate->sock);
-      GNUNET_NETWORK_socket_close(cstate->sock);
-    }
-  cancel_aps(cstate);
-  GNUNET_free(cstate->service_name);
-  GNUNET_free_non_null(cstate->hostname);
-  GNUNET_MST_destroy(cstate->mst);
-  GNUNET_free(cstate);
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "destroying socket: %p\n",
+         cstate->sock);
+    GNUNET_NETWORK_socket_close (cstate->sock);
+  }
+  cancel_aps (cstate);
+  GNUNET_free (cstate->service_name);
+  GNUNET_free_non_null (cstate->hostname);
+  GNUNET_MST_destroy (cstate->mst);
+  GNUNET_free (cstate);
 }
 
 
@@ -424,39 +427,39 @@ connection_client_destroy_impl(struct GNUNET_MQ_Handle 
*mq,
  * @param cls `struct ClientState` with connection to read from
  */
 static void
-receive_ready(void *cls)
+receive_ready (void *cls)
 {
   struct ClientState *cstate = cls;
   int ret;
 
   cstate->recv_task = NULL;
   cstate->in_destroy = GNUNET_SYSERR;
-  ret = GNUNET_MST_read(cstate->mst,
-                        cstate->sock,
-                        GNUNET_NO,
-                        GNUNET_NO);
+  ret = GNUNET_MST_read (cstate->mst,
+                         cstate->sock,
+                         GNUNET_NO,
+                         GNUNET_NO);
   if (GNUNET_SYSERR == ret)
-    {
-      if (NULL != cstate->mq)
-        GNUNET_MQ_inject_error(cstate->mq,
-                               GNUNET_MQ_ERROR_READ);
-      if (GNUNET_YES == cstate->in_destroy)
-        connection_client_destroy_impl(cstate->mq,
-                                       cstate);
-      return;
-    }
+  {
+    if (NULL != cstate->mq)
+      GNUNET_MQ_inject_error (cstate->mq,
+                              GNUNET_MQ_ERROR_READ);
+    if (GNUNET_YES == cstate->in_destroy)
+      connection_client_destroy_impl (cstate->mq,
+                                      cstate);
+    return;
+  }
   if (GNUNET_YES == cstate->in_destroy)
-    {
-      connection_client_destroy_impl(cstate->mq,
-                                     cstate);
-      return;
-    }
+  {
+    connection_client_destroy_impl (cstate->mq,
+                                    cstate);
+    return;
+  }
   cstate->in_destroy = GNUNET_NO;
   cstate->recv_task
-    = GNUNET_SCHEDULER_add_read_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                    cstate->sock,
-                                    &receive_ready,
-                                    cstate);
+    = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                     cstate->sock,
+                                     &receive_ready,
+                                     cstate);
 }
 
 
@@ -466,23 +469,23 @@ receive_ready(void *cls)
  * @param cstate the connection we tried to establish
  */
 static void
-connect_success_continuation(struct ClientState *cstate)
+connect_success_continuation (struct ClientState *cstate)
 {
-  GNUNET_assert(NULL == cstate->recv_task);
+  GNUNET_assert (NULL == cstate->recv_task);
   cstate->recv_task
-    = GNUNET_SCHEDULER_add_read_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                    cstate->sock,
-                                    &receive_ready,
-                                    cstate);
+    = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                     cstate->sock,
+                                     &receive_ready,
+                                     cstate);
   if (NULL != cstate->msg)
-    {
-      GNUNET_assert(NULL == cstate->send_task);
-      cstate->send_task
-        = GNUNET_SCHEDULER_add_write_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                         cstate->sock,
-                                         &transmit_ready,
-                                         cstate);
-    }
+  {
+    GNUNET_assert (NULL == cstate->send_task);
+    cstate->send_task
+      = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                        cstate->sock,
+                                        &transmit_ready,
+                                        cstate);
+  }
 }
 
 
@@ -494,8 +497,8 @@ connect_success_continuation(struct ClientState *cstate)
  * @return NULL on error, socket connected to UNIX otherwise
  */
 static struct GNUNET_NETWORK_Handle *
-try_unixpath(const char *service_name,
-             const struct GNUNET_CONFIGURATION_Handle *cfg)
+try_unixpath (const char *service_name,
+              const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
 #if AF_UNIX
   struct GNUNET_NETWORK_Handle *sock;
@@ -504,67 +507,56 @@ try_unixpath(const char *service_name,
 
   unixpath = NULL;
   if ((GNUNET_OK ==
-       GNUNET_CONFIGURATION_get_value_filename(cfg,
-                                               service_name,
-                                               "UNIXPATH",
-                                               &unixpath)) &&
-      (0 < strlen(unixpath)))
+       GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                                service_name,
+                                                "UNIXPATH",
+                                                &unixpath)) &&
+      (0 < strlen (unixpath)))
+  {
+    /* We have a non-NULL unixpath, need to validate it */
+    if (strlen (unixpath) >= sizeof(s_un.sun_path))
     {
-      /* We have a non-NULL unixpath, need to validate it */
-      if (strlen(unixpath) >= sizeof(s_un.sun_path))
-        {
-          LOG(GNUNET_ERROR_TYPE_WARNING,
-              _("UNIXPATH `%s' too long, maximum length is %llu\n"),
-              unixpath,
-              (unsigned long long)sizeof(s_un.sun_path));
-          unixpath = GNUNET_NETWORK_shorten_unixpath(unixpath);
-          LOG(GNUNET_ERROR_TYPE_INFO,
-              _("Using `%s' instead\n"),
-              unixpath);
-          if (NULL == unixpath)
-            return NULL;
-        }
-      memset(&s_un,
-             0,
-             sizeof(s_un));
-      s_un.sun_family = AF_UNIX;
-      GNUNET_strlcpy(s_un.sun_path,
-                     unixpath,
-                     sizeof(s_un.sun_path));
-#ifdef LINUX
-      {
-        int abstract;
-
-        abstract = GNUNET_CONFIGURATION_get_value_yesno(cfg,
-                                                        "TESTING",
-                                                        
"USE_ABSTRACT_SOCKETS");
-        if (GNUNET_YES == abstract)
-          s_un.sun_path[0] = '\0';
-      }
-#endif
+      LOG (GNUNET_ERROR_TYPE_WARNING,
+           _ ("UNIXPATH `%s' too long, maximum length is %llu\n"),
+           unixpath,
+           (unsigned long long) sizeof(s_un.sun_path));
+      unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath);
+      LOG (GNUNET_ERROR_TYPE_INFO,
+           _ ("Using `%s' instead\n"),
+           unixpath);
+      if (NULL == unixpath)
+        return NULL;
+    }
+    memset (&s_un,
+            0,
+            sizeof(s_un));
+    s_un.sun_family = AF_UNIX;
+    GNUNET_strlcpy (s_un.sun_path,
+                    unixpath,
+                    sizeof(s_un.sun_path));
 #if HAVE_SOCKADDR_UN_SUN_LEN
-      s_un.sun_len = (u_char)sizeof(struct sockaddr_un);
+    s_un.sun_len = (u_char) sizeof(struct sockaddr_un);
 #endif
-      sock = GNUNET_NETWORK_socket_create(AF_UNIX,
-                                          SOCK_STREAM,
-                                          0);
-      if ((NULL != sock) &&
-          ((GNUNET_OK ==
-            GNUNET_NETWORK_socket_connect(sock,
-                                          (struct sockaddr *)&s_un,
-                                          sizeof(s_un))) ||
-           (EINPROGRESS == errno)))
-        {
-          LOG(GNUNET_ERROR_TYPE_DEBUG,
-              "Successfully connected to unixpath `%s'!\n",
-              unixpath);
-          GNUNET_free(unixpath);
-          return sock;
-        }
-      if (NULL != sock)
-        GNUNET_NETWORK_socket_close(sock);
+    sock = GNUNET_NETWORK_socket_create (AF_UNIX,
+                                         SOCK_STREAM,
+                                         0);
+    if ((NULL != sock) &&
+        ((GNUNET_OK ==
+          GNUNET_NETWORK_socket_connect (sock,
+                                         (struct sockaddr *) &s_un,
+                                         sizeof(s_un))) ||
+         (EINPROGRESS == errno)))
+    {
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "Successfully connected to unixpath `%s'!\n",
+           unixpath);
+      GNUNET_free (unixpath);
+      return sock;
     }
-  GNUNET_free_non_null(unixpath);
+    if (NULL != sock)
+      GNUNET_NETWORK_socket_close (sock);
+  }
+  GNUNET_free_non_null (unixpath);
 #endif
   return NULL;
 }
@@ -577,7 +569,7 @@ try_unixpath(const char *service_name,
  * @param cls the `struct AddressProbe *` with the address that we are probing
  */
 static void
-connect_probe_continuation(void *cls)
+connect_probe_continuation (void *cls)
 {
   struct AddressProbe *ap = cls;
   struct ClientState *cstate = ap->cstate;
@@ -586,40 +578,40 @@ connect_probe_continuation(void *cls)
   socklen_t len;
 
   ap->task = NULL;
-  GNUNET_assert(NULL != ap->sock);
-  GNUNET_CONTAINER_DLL_remove(cstate->ap_head,
-                              cstate->ap_tail,
-                              ap);
+  GNUNET_assert (NULL != ap->sock);
+  GNUNET_CONTAINER_DLL_remove (cstate->ap_head,
+                               cstate->ap_tail,
+                               ap);
   len = sizeof(error);
   error = 0;
-  tc = GNUNET_SCHEDULER_get_task_context();
+  tc = GNUNET_SCHEDULER_get_task_context ();
   if ((0 == (tc->reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) ||
       (GNUNET_OK !=
-       GNUNET_NETWORK_socket_getsockopt(ap->sock,
-                                        SOL_SOCKET,
-                                        SO_ERROR,
-                                        &error,
-                                        &len)) ||
+       GNUNET_NETWORK_socket_getsockopt (ap->sock,
+                                         SOL_SOCKET,
+                                         SO_ERROR,
+                                         &error,
+                                         &len)) ||
       (0 != error))
-    {
-      GNUNET_break(GNUNET_OK ==
-                   GNUNET_NETWORK_socket_close(ap->sock));
-      GNUNET_free(ap);
-      if ((NULL == cstate->ap_head) &&
-          //    (NULL == cstate->proxy_handshake) &&
-          (NULL == cstate->dns_active))
-        connect_fail_continuation(cstate);
-      return;
-    }
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "Connection to `%s' succeeded!\n",
-      cstate->service_name);
+  {
+    GNUNET_break (GNUNET_OK ==
+                  GNUNET_NETWORK_socket_close (ap->sock));
+    GNUNET_free (ap);
+    if ((NULL == cstate->ap_head) &&
+        //      (NULL == cstate->proxy_handshake) &&
+        (NULL == cstate->dns_active))
+      connect_fail_continuation (cstate);
+    return;
+  }
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Connection to `%s' succeeded!\n",
+       cstate->service_name);
   /* trigger jobs that waited for the connection */
-  GNUNET_assert(NULL == cstate->sock);
+  GNUNET_assert (NULL == cstate->sock);
   cstate->sock = ap->sock;
-  GNUNET_free(ap);
-  cancel_aps(cstate);
-  connect_success_continuation(cstate);
+  GNUNET_free (ap);
+  cancel_aps (cstate);
+  connect_success_continuation (cstate);
 }
 
 
@@ -632,82 +624,82 @@ connect_probe_continuation(void *cls)
  * @param addrlen length of @a addr
  */
 static void
-try_connect_using_address(void *cls,
-                          const struct sockaddr *addr,
-                          socklen_t addrlen)
+try_connect_using_address (void *cls,
+                           const struct sockaddr *addr,
+                           socklen_t addrlen)
 {
   struct ClientState *cstate = cls;
   struct AddressProbe *ap;
 
   if (NULL == addr)
-    {
-      cstate->dns_active = NULL;
-      if ((NULL == cstate->ap_head) &&
-          //  (NULL == cstate->proxy_handshake) &&
-          (NULL == cstate->sock))
-        connect_fail_continuation(cstate);
-      return;
-    }
+  {
+    cstate->dns_active = NULL;
+    if ((NULL == cstate->ap_head) &&
+        //  (NULL == cstate->proxy_handshake) &&
+        (NULL == cstate->sock))
+      connect_fail_continuation (cstate);
+    return;
+  }
   if (NULL != cstate->sock)
     return;                     /* already connected */
   /* try to connect */
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "Trying to connect using address `%s:%u'\n",
-      GNUNET_a2s(addr,
-                 addrlen),
-      cstate->port);
-  ap = GNUNET_malloc(sizeof(struct AddressProbe) + addrlen);
-  ap->addr = (const struct sockaddr *)&ap[1];
-  GNUNET_memcpy(&ap[1],
-                addr,
-                addrlen);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Trying to connect using address `%s:%u'\n",
+       GNUNET_a2s (addr,
+                   addrlen),
+       cstate->port);
+  ap = GNUNET_malloc (sizeof(struct AddressProbe) + addrlen);
+  ap->addr = (const struct sockaddr *) &ap[1];
+  GNUNET_memcpy (&ap[1],
+                 addr,
+                 addrlen);
   ap->addrlen = addrlen;
   ap->cstate = cstate;
 
   switch (ap->addr->sa_family)
-    {
-    case AF_INET:
-      ((struct sockaddr_in *)ap->addr)->sin_port = htons(cstate->port);
-      break;
-
-    case AF_INET6:
-      ((struct sockaddr_in6 *)ap->addr)->sin6_port = htons(cstate->port);
-      break;
-
-    default:
-      GNUNET_break(0);
-      GNUNET_free(ap);
-      return;                   /* not supported by us */
-    }
-  ap->sock = GNUNET_NETWORK_socket_create(ap->addr->sa_family,
-                                          SOCK_STREAM,
-                                          0);
+  {
+  case AF_INET:
+    ((struct sockaddr_in *) ap->addr)->sin_port = htons (cstate->port);
+    break;
+
+  case AF_INET6:
+    ((struct sockaddr_in6 *) ap->addr)->sin6_port = htons (cstate->port);
+    break;
+
+  default:
+    GNUNET_break (0);
+    GNUNET_free (ap);
+    return;                     /* not supported by us */
+  }
+  ap->sock = GNUNET_NETWORK_socket_create (ap->addr->sa_family,
+                                           SOCK_STREAM,
+                                           0);
   if (NULL == ap->sock)
-    {
-      GNUNET_free(ap);
-      return;                   /* not supported by OS */
-    }
+  {
+    GNUNET_free (ap);
+    return;                     /* not supported by OS */
+  }
   if ((GNUNET_OK !=
-       GNUNET_NETWORK_socket_connect(ap->sock,
-                                     ap->addr,
-                                     ap->addrlen)) &&
+       GNUNET_NETWORK_socket_connect (ap->sock,
+                                      ap->addr,
+                                      ap->addrlen)) &&
       (EINPROGRESS != errno))
-    {
-      /* maybe refused / unsupported address, try next */
-      GNUNET_log_strerror(GNUNET_ERROR_TYPE_INFO,
-                          "connect");
-      GNUNET_break(GNUNET_OK ==
-                   GNUNET_NETWORK_socket_close(ap->sock));
-      GNUNET_free(ap);
-      return;
-    }
-  GNUNET_CONTAINER_DLL_insert(cstate->ap_head,
-                              cstate->ap_tail,
-                              ap);
-  ap->task = GNUNET_SCHEDULER_add_write_net(CONNECT_RETRY_TIMEOUT,
-                                            ap->sock,
-                                            &connect_probe_continuation,
-                                            ap);
+  {
+    /* maybe refused / unsupported address, try next */
+    GNUNET_log_strerror (GNUNET_ERROR_TYPE_INFO,
+                         "connect");
+    GNUNET_break (GNUNET_OK ==
+                  GNUNET_NETWORK_socket_close (ap->sock));
+    GNUNET_free (ap);
+    return;
+  }
+  GNUNET_CONTAINER_DLL_insert (cstate->ap_head,
+                               cstate->ap_tail,
+                               ap);
+  ap->task = GNUNET_SCHEDULER_add_write_net (CONNECT_RETRY_TIMEOUT,
+                                             ap->sock,
+                                             &connect_probe_continuation,
+                                             ap);
 }
 
 
@@ -720,8 +712,8 @@ try_connect_using_address(void *cls,
  * @return #GNUNET_OK if the configuration is valid, #GNUNET_SYSERR if not
  */
 static int
-test_service_configuration(const char *service_name,
-                           const struct GNUNET_CONFIGURATION_Handle *cfg)
+test_service_configuration (const char *service_name,
+                            const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   int ret = GNUNET_SYSERR;
   char *hostname = NULL;
@@ -731,45 +723,45 @@ test_service_configuration(const char *service_name,
   char *unixpath = NULL;
 
   if ((GNUNET_OK ==
-       GNUNET_CONFIGURATION_get_value_filename(cfg,
-                                               service_name,
-                                               "UNIXPATH",
-                                               &unixpath)) &&
-      (0 < strlen(unixpath)))
+       GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                                service_name,
+                                                "UNIXPATH",
+                                                &unixpath)) &&
+      (0 < strlen (unixpath)))
     ret = GNUNET_OK;
   else if ((GNUNET_OK ==
-            GNUNET_CONFIGURATION_have_value(cfg,
-                                            service_name,
-                                            "UNIXPATH")))
-    {
-      GNUNET_log_config_invalid(GNUNET_ERROR_TYPE_ERROR,
-                                service_name,
-                                "UNIXPATH",
-                                _("not a valid filename"));
-      return GNUNET_SYSERR; /* UNIXPATH specified but invalid! */
-    }
-  GNUNET_free_non_null(unixpath);
+            GNUNET_CONFIGURATION_have_value (cfg,
+                                             service_name,
+                                             "UNIXPATH")))
+  {
+    GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+                               service_name,
+                               "UNIXPATH",
+                               _ ("not a valid filename"));
+    return GNUNET_SYSERR;   /* UNIXPATH specified but invalid! */
+  }
+  GNUNET_free_non_null (unixpath);
 #endif
 
   if ((GNUNET_YES ==
-       GNUNET_CONFIGURATION_have_value(cfg,
-                                       service_name,
-                                       "PORT")) &&
+       GNUNET_CONFIGURATION_have_value (cfg,
+                                        service_name,
+                                        "PORT")) &&
       (GNUNET_OK ==
-       GNUNET_CONFIGURATION_get_value_number(cfg,
-                                             service_name,
-                                             "PORT",
-                                             &port)) &&
+       GNUNET_CONFIGURATION_get_value_number (cfg,
+                                              service_name,
+                                              "PORT",
+                                              &port)) &&
       (port <= 65535) &&
       (0 != port) &&
       (GNUNET_OK ==
-       GNUNET_CONFIGURATION_get_value_string(cfg,
-                                             service_name,
-                                             "HOSTNAME",
-                                             &hostname)) &&
-      (0 != strlen(hostname)))
+       GNUNET_CONFIGURATION_get_value_string (cfg,
+                                              service_name,
+                                              "HOSTNAME",
+                                              &hostname)) &&
+      (0 != strlen (hostname)))
     ret = GNUNET_OK;
-  GNUNET_free_non_null(hostname);
+  GNUNET_free_non_null (hostname);
   return ret;
 }
 
@@ -780,7 +772,7 @@ test_service_configuration(const char *service_name,
  * @param cls the `struct ClientState` to try to connect to the service
  */
 static void
-start_connect(void *cls)
+start_connect (void *cls)
 {
   struct ClientState *cstate = cls;
 
@@ -788,41 +780,41 @@ start_connect(void *cls)
 #if 0
   /* Never use a local source if a proxy is configured */
   if (GNUNET_YES ==
-      GNUNET_SOCKS_check_service(cstate->service_name,
-                                 cstate->cfg))
-    {
-      socks_connect(cstate);
-      return;
-    }
+      GNUNET_SOCKS_check_service (cstate->service_name,
+                                  cstate->cfg))
+  {
+    socks_connect (cstate);
+    return;
+  }
 #endif
 
   if ((0 == (cstate->attempts++ % 2)) ||
       (0 == cstate->port) ||
       (NULL == cstate->hostname))
+  {
+    /* on even rounds, try UNIX first, or always
+       if we do not have a DNS name and TCP port. */
+    cstate->sock = try_unixpath (cstate->service_name,
+                                 cstate->cfg);
+    if (NULL != cstate->sock)
     {
-      /* on even rounds, try UNIX first, or always
-         if we do not have a DNS name and TCP port. */
-      cstate->sock = try_unixpath(cstate->service_name,
-                                  cstate->cfg);
-      if (NULL != cstate->sock)
-        {
-          connect_success_continuation(cstate);
-          return;
-        }
+      connect_success_continuation (cstate);
+      return;
     }
+  }
   if ((NULL == cstate->hostname) ||
       (0 == cstate->port))
-    {
-      /* All options failed. Boo! */
-      connect_fail_continuation(cstate);
-      return;
-    }
+  {
+    /* All options failed. Boo! */
+    connect_fail_continuation (cstate);
+    return;
+  }
   cstate->dns_active
-    = GNUNET_RESOLVER_ip_get(cstate->hostname,
-                             AF_UNSPEC,
-                             CONNECT_RETRY_TIMEOUT,
-                             &try_connect_using_address,
-                             cstate);
+    = GNUNET_RESOLVER_ip_get (cstate->hostname,
+                              AF_UNSPEC,
+                              CONNECT_RETRY_TIMEOUT,
+                              &try_connect_using_address,
+                              cstate);
 }
 
 
@@ -834,30 +826,30 @@ start_connect(void *cls)
  * @param impl_state our `struct ClientState`
  */
 static void
-connection_client_send_impl(struct GNUNET_MQ_Handle *mq,
-                            const struct GNUNET_MessageHeader *msg,
-                            void *impl_state)
+connection_client_send_impl (struct GNUNET_MQ_Handle *mq,
+                             const struct GNUNET_MessageHeader *msg,
+                             void *impl_state)
 {
   struct ClientState *cstate = impl_state;
 
-  (void)mq;
+  (void) mq;
   /* only one message at a time allowed */
-  GNUNET_assert(NULL == cstate->msg);
-  GNUNET_assert(NULL == cstate->send_task);
+  GNUNET_assert (NULL == cstate->msg);
+  GNUNET_assert (NULL == cstate->send_task);
   cstate->msg = msg;
   cstate->msg_off = 0;
   if (NULL == cstate->sock)
-    {
-      LOG(GNUNET_ERROR_TYPE_DEBUG,
-          "message of type %u waiting for socket\n",
-          ntohs(msg->type));
-      return; /* still waiting for connection */
-    }
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "message of type %u waiting for socket\n",
+         ntohs (msg->type));
+    return;   /* still waiting for connection */
+  }
   cstate->send_task
-    = GNUNET_SCHEDULER_add_write_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                     cstate->sock,
-                                     &transmit_ready,
-                                     cstate);
+    = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                      cstate->sock,
+                                      &transmit_ready,
+                                      cstate);
 }
 
 
@@ -868,20 +860,186 @@ connection_client_send_impl(struct GNUNET_MQ_Handle *mq,
  * @param impl_state our `struct ClientState`
  */
 static void
-connection_client_cancel_impl(struct GNUNET_MQ_Handle *mq,
-                              void *impl_state)
+connection_client_cancel_impl (struct GNUNET_MQ_Handle *mq,
+                               void *impl_state)
 {
   struct ClientState *cstate = impl_state;
 
-  (void)mq;
-  GNUNET_assert(NULL != cstate->msg);
-  GNUNET_assert(0 == cstate->msg_off);
+  (void) mq;
+  GNUNET_assert (NULL != cstate->msg);
+  GNUNET_assert (0 == cstate->msg_off);
   cstate->msg = NULL;
   if (NULL != cstate->send_task)
+  {
+    GNUNET_SCHEDULER_cancel (cstate->send_task);
+    cstate->send_task = NULL;
+  }
+}
+
+
+/**
+ * Test if the port or UNIXPATH of the given @a service_name
+ * is in use and thus (most likely) the respective service is up.
+ *
+ * @param cfg our configuration
+ * @param service_name name of the service to connect to
+ * @return #GNUNET_YES if the service is (likely) up,
+ *         #GNUNET_NO if the service is (definitively) down,
+ *         #GNUNET_SYSERR if the configuration does not give us
+ *          the necessary information about the service, or if
+ *          we could not check (i.e. socket() failed)
+ */
+int
+GNUNET_CLIENT_test (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                    const char *service_name)
+{
+  char *hostname = NULL;
+  unsigned long long port;
+  int ret;
+
+#if AF_UNIX
+  {
+    char *unixpath = NULL;
+
+    if (GNUNET_OK ==
+        GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                                 service_name,
+                                                 "UNIXPATH",
+                                                 &unixpath))
     {
-      GNUNET_SCHEDULER_cancel(cstate->send_task);
-      cstate->send_task = NULL;
+      if (0 == strlen (unixpath))
+      {
+        GNUNET_free (unixpath);
+        return GNUNET_SYSERR; /* empty string not OK */
+      }
+      if (0 == access (unixpath,
+                       F_OK))
+      {
+        GNUNET_free (unixpath);
+        return GNUNET_OK; /* file exists, we assume service is running */
+      }
+      GNUNET_free (unixpath);
+    }
+    else if (GNUNET_OK ==
+             GNUNET_CONFIGURATION_have_value (cfg,
+                                              service_name,
+                                              "UNIXPATH"))
+    {
+      /* UNIXPATH specified but not a valid path! */
+      GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+                                 service_name,
+                                 "UNIXPATH",
+                                 _ ("not a valid filename"));
+      return GNUNET_SYSERR;
     }
+  }
+#endif
+
+  if ( (GNUNET_OK !=
+        GNUNET_CONFIGURATION_get_value_number (cfg,
+                                               service_name,
+                                               "PORT",
+                                               &port)) ||
+       (port > 65535) ||
+       (0 == port) )
+  {
+    return GNUNET_SYSERR;
+  }
+  if (GNUNET_OK ==
+      GNUNET_CONFIGURATION_get_value_string (cfg,
+                                             service_name,
+                                             "HOSTNAME",
+                                             &hostname))
+  {
+    /* We always assume remotes are up */
+    ret = GNUNET_YES;
+  }
+  else
+  {
+    /* We look for evidence the service is up */
+    ret = GNUNET_NO;
+  }
+  if ( (NULL == hostname) ||
+       (0 == strcasecmp (hostname,
+                         "localhost")) ||
+       (0 == strcasecmp (hostname,
+                         "ip6-localnet")) )
+  {
+    /* service runs on loopback */
+    struct sockaddr_in v4;
+    struct sockaddr_in6 v6;
+    int sock;
+
+    memset (&v4, 0, sizeof (v4));
+    memset (&v6, 0, sizeof (v6));
+    v4.sin_family = AF_INET;
+    v4.sin_port = htons ((uint16_t) port);
+#if HAVE_SOCKADDR_IN_SUN_LEN
+    v4.sin_len = (u_char) sizeof(struct sockaddr_in);
+#endif
+    inet_pton (AF_INET,
+               "127.0.0.1",
+               &v4.sin_addr);
+    ret = GNUNET_NO;
+    sock = socket (AF_INET,
+                   SOCK_STREAM,
+                   0);
+    if (-1 != sock)
+    {
+      if (0 != bind (sock,
+                     (struct sockaddr *) &v4,
+                     sizeof (v4)))
+      {
+        /* bind failed, so someone is listening! */
+        ret = GNUNET_YES;
+      }
+      (void) close (sock);
+    }
+    else
+    {
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+                           "socket");
+      if (GNUNET_NO == ret)
+        ret = GNUNET_SYSERR;
+    }
+    v6.sin6_family = AF_INET6;
+    v6.sin6_port = htons ((uint16_t) port);
+#if HAVE_SOCKADDR_IN_SUN_LEN
+    v6.sin6_len = (u_char) sizeof(struct sockaddr_in6);
+#endif
+    inet_pton (AF_INET6,
+               "::1",
+               &v6.sin6_addr);
+    sock = socket (AF_INET6,
+                   SOCK_STREAM,
+                   0);
+    if (-1 != sock)
+    {
+      if (0 != bind (sock,
+                     (struct sockaddr *) &v6,
+                     sizeof (v6)))
+      {
+        /* bind failed, so someone is listening! */
+        ret = GNUNET_YES;
+      }
+      (void) close (sock);
+    }
+    else
+    {
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+                           "socket");
+      /* not changing 'ret' intentionally here, as
+         v4 succeeding and v6 failing just means we
+         should use v4 */
+    }
+  }
+  else
+  {
+    /* service running remotely */
+    ret = GNUNET_OK;
+  }
+  GNUNET_free_non_null (hostname);
+  return ret;
 }
 
 
@@ -897,57 +1055,57 @@ connection_client_cancel_impl(struct GNUNET_MQ_Handle 
*mq,
  * @return the message queue, NULL on error
  */
 struct GNUNET_MQ_Handle *
-GNUNET_CLIENT_connect(const struct GNUNET_CONFIGURATION_Handle *cfg,
-                      const char *service_name,
-                      const struct GNUNET_MQ_MessageHandler *handlers,
-                      GNUNET_MQ_ErrorHandler error_handler,
-                      void *error_handler_cls)
+GNUNET_CLIENT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                       const char *service_name,
+                       const struct GNUNET_MQ_MessageHandler *handlers,
+                       GNUNET_MQ_ErrorHandler error_handler,
+                       void *error_handler_cls)
 {
   struct ClientState *cstate;
 
   if (GNUNET_OK !=
-      test_service_configuration(service_name,
-                                 cfg))
+      test_service_configuration (service_name,
+                                  cfg))
     return NULL;
-  cstate = GNUNET_new(struct ClientState);
-  cstate->service_name = GNUNET_strdup(service_name);
+  cstate = GNUNET_new (struct ClientState);
+  cstate->service_name = GNUNET_strdup (service_name);
   cstate->cfg = cfg;
-  cstate->retry_task = GNUNET_SCHEDULER_add_now(&start_connect,
-                                                cstate);
-  cstate->mst = GNUNET_MST_create(&recv_message,
-                                  cstate);
+  cstate->retry_task = GNUNET_SCHEDULER_add_now (&start_connect,
+                                                 cstate);
+  cstate->mst = GNUNET_MST_create (&recv_message,
+                                   cstate);
   if (GNUNET_YES ==
-      GNUNET_CONFIGURATION_have_value(cfg,
-                                      service_name,
-                                      "PORT"))
-    {
-      if (!((GNUNET_OK !=
-             GNUNET_CONFIGURATION_get_value_number(cfg,
+      GNUNET_CONFIGURATION_have_value (cfg,
+                                       service_name,
+                                       "PORT"))
+  {
+    if (! ((GNUNET_OK !=
+            GNUNET_CONFIGURATION_get_value_number (cfg,
                                                    service_name,
                                                    "PORT",
                                                    &cstate->port)) ||
-            (cstate->port > 65535) ||
-            (GNUNET_OK !=
-             GNUNET_CONFIGURATION_get_value_string(cfg,
+           (cstate->port > 65535) ||
+           (GNUNET_OK !=
+            GNUNET_CONFIGURATION_get_value_string (cfg,
                                                    service_name,
                                                    "HOSTNAME",
                                                    &cstate->hostname))) &&
-          (0 == strlen(cstate->hostname)))
-        {
-          GNUNET_free(cstate->hostname);
-          cstate->hostname = NULL;
-          LOG(GNUNET_ERROR_TYPE_WARNING,
-              _("Need a non-empty hostname for service `%s'.\n"),
-              service_name);
-        }
+        (0 == strlen (cstate->hostname)))
+    {
+      GNUNET_free (cstate->hostname);
+      cstate->hostname = NULL;
+      LOG (GNUNET_ERROR_TYPE_WARNING,
+           _ ("Need a non-empty hostname for service `%s'.\n"),
+           service_name);
     }
-  cstate->mq = GNUNET_MQ_queue_for_callbacks(&connection_client_send_impl,
-                                             &connection_client_destroy_impl,
-                                             &connection_client_cancel_impl,
-                                             cstate,
-                                             handlers,
-                                             error_handler,
-                                             error_handler_cls);
+  }
+  cstate->mq = GNUNET_MQ_queue_for_callbacks (&connection_client_send_impl,
+                                              &connection_client_destroy_impl,
+                                              &connection_client_cancel_impl,
+                                              cstate,
+                                              handlers,
+                                              error_handler,
+                                              error_handler_cls);
   return cstate->mq;
 }
 
diff --git a/src/util/service.c b/src/util/service.c
index b0f4ea289..25c1ba338 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -37,19 +37,20 @@
 #endif
 
 
-#define LOG(kind, ...) GNUNET_log_from(kind, "util-service", __VA_ARGS__)
+#define LOG(kind, ...) GNUNET_log_from (kind, "util-service", __VA_ARGS__)
 
 #define LOG_STRERROR(kind, syscall) \
-  GNUNET_log_from_strerror(kind, "util-service", syscall)
+  GNUNET_log_from_strerror (kind, "util-service", syscall)
 
 #define LOG_STRERROR_FILE(kind, syscall, filename) \
-  GNUNET_log_from_strerror_file(kind, "util-service", syscall, filename)
+  GNUNET_log_from_strerror_file (kind, "util-service", syscall, filename)
 
 
 /**
  * Information the service tracks per listen operation.
  */
-struct ServiceListenContext {
+struct ServiceListenContext
+{
   /**
    * Kept in a DLL.
    */
@@ -80,7 +81,8 @@ struct ServiceListenContext {
 /**
  * Reasons why we might be suspended.
  */
-enum SuspendReason {
+enum SuspendReason
+{
   /**
    * We are running normally.
    */
@@ -111,7 +113,8 @@ enum SuspendReason {
 /**
  * Handle to a service.
  */
-struct GNUNET_SERVICE_Handle {
+struct GNUNET_SERVICE_Handle
+{
   /**
    * Our configuration.
    */
@@ -243,7 +246,8 @@ struct GNUNET_SERVICE_Handle {
 /**
  * Handle to a client that is connected to a service.
  */
-struct GNUNET_SERVICE_Client {
+struct GNUNET_SERVICE_Client
+{
   /**
    * Kept in a DLL.
    */
@@ -353,15 +357,15 @@ struct GNUNET_SERVICE_Client {
  * @return #GNUNET_YES if we have non-monitoring clients left
  */
 static int
-have_non_monitor_clients(struct GNUNET_SERVICE_Handle *sh)
+have_non_monitor_clients (struct GNUNET_SERVICE_Handle *sh)
 {
   for (struct GNUNET_SERVICE_Client *client = sh->clients_head; NULL != client;
        client = client->next)
-    {
-      if (client->is_monitor)
-        continue;
-      return GNUNET_YES;
-    }
+  {
+    if (client->is_monitor)
+      continue;
+    return GNUNET_YES;
+  }
   return GNUNET_NO;
 }
 
@@ -374,20 +378,20 @@ 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));
+  GNUNET_assert (0 == (sh->suspend_state & sr));
   sh->suspend_state |= sr;
   for (slc = sh->slc_head; NULL != slc; slc = slc->next)
+  {
+    if (NULL != slc->listen_task)
     {
-      if (NULL != slc->listen_task)
-        {
-          GNUNET_SCHEDULER_cancel(slc->listen_task);
-          slc->listen_task = NULL;
-        }
+      GNUNET_SCHEDULER_cancel (slc->listen_task);
+      slc->listen_task = NULL;
     }
+  }
 }
 
 
@@ -400,29 +404,29 @@ do_suspend(struct GNUNET_SERVICE_Handle *sh, enum 
SuspendReason sr)
  * @param cls our `struct GNUNET_SERVICE_Handle`
  */
 static void
-service_shutdown(void *cls)
+service_shutdown (void *cls)
 {
   struct GNUNET_SERVICE_Handle *sh = cls;
 
   switch (sh->options)
-    {
-    case GNUNET_SERVICE_OPTION_NONE:
-      GNUNET_SERVICE_shutdown(sh);
-      break;
-
-    case GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN:
-      /* This task should never be run if we are using
-         the manual shutdown. */
-      GNUNET_assert(0);
-      break;
-
-    case GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN:
-      if (0 == (sh->suspend_state & SUSPEND_STATE_SHUTDOWN))
-        do_suspend(sh, SUSPEND_STATE_SHUTDOWN);
-      if (GNUNET_NO == have_non_monitor_clients(sh))
-        GNUNET_SERVICE_shutdown(sh);
-      break;
-    }
+  {
+  case GNUNET_SERVICE_OPTION_NONE:
+    GNUNET_SERVICE_shutdown (sh);
+    break;
+
+  case GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN:
+    /* This task should never be run if we are using
+       the manual shutdown. */
+    GNUNET_assert (0);
+    break;
+
+  case GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN:
+    if (0 == (sh->suspend_state & SUSPEND_STATE_SHUTDOWN))
+      do_suspend (sh, SUSPEND_STATE_SHUTDOWN);
+    if (GNUNET_NO == have_non_monitor_clients (sh))
+      GNUNET_SERVICE_shutdown (sh);
+    break;
+  }
 }
 
 
@@ -434,8 +438,8 @@ service_shutdown(void *cls)
  * @return #GNUNET_NO if the IP is not in the list, #GNUNET_YES if it it is
  */
 static int
-check_ipv4_listed(const struct GNUNET_STRINGS_IPv4NetworkPolicy *list,
-                  const struct in_addr *add)
+check_ipv4_listed (const struct GNUNET_STRINGS_IPv4NetworkPolicy *list,
+                   const struct in_addr *add)
 {
   unsigned int i;
 
@@ -443,12 +447,12 @@ check_ipv4_listed(const struct 
GNUNET_STRINGS_IPv4NetworkPolicy *list,
     return GNUNET_NO;
   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;
-      i++;
-    }
+  {
+    if ((add->s_addr & list[i].netmask.s_addr) ==
+        (list[i].network.s_addr & list[i].netmask.s_addr))
+      return GNUNET_YES;
+    i++;
+  }
   return GNUNET_NO;
 }
 
@@ -461,8 +465,8 @@ check_ipv4_listed(const struct 
GNUNET_STRINGS_IPv4NetworkPolicy *list,
  * @return #GNUNET_NO if the IP is not in the list, #GNUNET_YES if it it is
  */
 static int
-check_ipv6_listed(const struct GNUNET_STRINGS_IPv6NetworkPolicy *list,
-                  const struct in6_addr *ip)
+check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list,
+                   const struct in6_addr *ip)
 {
   unsigned int i;
   unsigned int j;
@@ -471,17 +475,17 @@ check_ipv6_listed(const struct 
GNUNET_STRINGS_IPv6NetworkPolicy *list,
     return GNUNET_NO;
   i = 0;
 NEXT:
-  while (0 != GNUNET_is_zero(&list[i].network))
-    {
-      for (j = 0; j < sizeof(struct in6_addr) / sizeof(int); j++)
-        if (((((int *)ip)[j] & ((int *)&list[i].netmask)[j])) !=
-            (((int *)&list[i].network)[j] & ((int *)&list[i].netmask)[j]))
-          {
-            i++;
-            goto NEXT;
-          }
-      return GNUNET_YES;
-    }
+  while (0 != GNUNET_is_zero (&list[i].network))
+  {
+    for (j = 0; j < sizeof(struct in6_addr) / sizeof(int); j++)
+      if (((((int *) ip)[j] & ((int *) &list[i].netmask)[j])) !=
+          (((int *) &list[i].network)[j] & ((int *) &list[i].netmask)[j]))
+      {
+        i++;
+        goto NEXT;
+      }
+    return GNUNET_YES;
+  }
   return GNUNET_NO;
 }
 
@@ -493,63 +497,63 @@ NEXT:
  * @param cls the `struct GNUNET_SERVICE_Client *` to send to
  */
 static void
-do_send(void *cls)
+do_send (void *cls)
 {
   struct GNUNET_SERVICE_Client *client = cls;
   ssize_t ret;
   size_t left;
   const char *buf;
 
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "service: sending message with type %u\n",
-      ntohs(client->msg->type));
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "service: sending message with type %u\n",
+       ntohs (client->msg->type));
 
 
   client->send_task = NULL;
-  buf = (const char *)client->msg;
-  left = ntohs(client->msg->size) - client->msg_pos;
-  ret = GNUNET_NETWORK_socket_send(client->sock, &buf[client->msg_pos], left);
-  GNUNET_assert(ret <= (ssize_t)left);
+  buf = (const char *) client->msg;
+  left = ntohs (client->msg->size) - client->msg_pos;
+  ret = GNUNET_NETWORK_socket_send (client->sock, &buf[client->msg_pos], left);
+  GNUNET_assert (ret <= (ssize_t) left);
   if (0 == ret)
-    {
-      LOG(GNUNET_ERROR_TYPE_DEBUG, "no data send");
-      GNUNET_MQ_inject_error(client->mq, GNUNET_MQ_ERROR_WRITE);
-      return;
-    }
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "no data send");
+    GNUNET_MQ_inject_error (client->mq, GNUNET_MQ_ERROR_WRITE);
+    return;
+  }
   if (-1 == ret)
+  {
+    if ((EAGAIN == errno) || (EINTR == errno))
     {
-      if ((EAGAIN == errno) || (EINTR == errno))
-        {
-          /* ignore */
-          ret = 0;
-        }
-      else
-        {
-          if (EPIPE != errno)
-            GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, "send");
-          LOG(GNUNET_ERROR_TYPE_DEBUG,
-              "socket send returned with error code %i",
-              errno);
-          GNUNET_MQ_inject_error(client->mq, GNUNET_MQ_ERROR_WRITE);
-          return;
-        }
-    }
-  if (0 == client->msg_pos)
-    {
-      GNUNET_MQ_impl_send_in_flight(client->mq);
+      /* ignore */
+      ret = 0;
     }
-  client->msg_pos += ret;
-  if (left > (size_t)ret)
+    else
     {
-      GNUNET_assert(NULL == client->drop_task);
-      client->send_task =
-        GNUNET_SCHEDULER_add_write_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                       client->sock,
-                                       &do_send,
-                                       client);
+      if (EPIPE != errno)
+        GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "send");
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "socket send returned with error code %i",
+           errno);
+      GNUNET_MQ_inject_error (client->mq, GNUNET_MQ_ERROR_WRITE);
       return;
     }
-  GNUNET_MQ_impl_send_continue(client->mq);
+  }
+  if (0 == client->msg_pos)
+  {
+    GNUNET_MQ_impl_send_in_flight (client->mq);
+  }
+  client->msg_pos += ret;
+  if (left > (size_t) ret)
+  {
+    GNUNET_assert (NULL == client->drop_task);
+    client->send_task =
+      GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                      client->sock,
+                                      &do_send,
+                                      client);
+    return;
+  }
+  GNUNET_MQ_impl_send_continue (client->mq);
 }
 
 
@@ -562,27 +566,27 @@ do_send(void *cls)
  * @param impl_state our `struct GNUNET_SERVICE_Client *`
  */
 static void
-service_mq_send(struct GNUNET_MQ_Handle *mq,
-                const struct GNUNET_MessageHeader *msg,
-                void *impl_state)
+service_mq_send (struct GNUNET_MQ_Handle *mq,
+                 const struct GNUNET_MessageHeader *msg,
+                 void *impl_state)
 {
   struct GNUNET_SERVICE_Client *client = impl_state;
 
-  (void)mq;
+  (void) mq;
   if (NULL != client->drop_task)
     return; /* we're going down right now, do not try to send */
-  GNUNET_assert(NULL == client->send_task);
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "Sending message of type %u and size %u to client\n",
-      ntohs(msg->type),
-      ntohs(msg->size));
+  GNUNET_assert (NULL == client->send_task);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Sending message of type %u and size %u to client\n",
+       ntohs (msg->type),
+       ntohs (msg->size));
   client->msg = msg;
   client->msg_pos = 0;
   client->send_task =
-    GNUNET_SCHEDULER_add_write_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                   client->sock,
-                                   &do_send,
-                                   client);
+    GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                    client->sock,
+                                    &do_send,
+                                    client);
 }
 
 
@@ -593,14 +597,14 @@ 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;
 
-  (void)mq;
-  GNUNET_assert(0 == client->msg_pos);
+  (void) mq;
+  GNUNET_assert (0 == client->msg_pos);
   client->msg = NULL;
-  GNUNET_SCHEDULER_cancel(client->send_task);
+  GNUNET_SCHEDULER_cancel (client->send_task);
   client->send_task = NULL;
 }
 
@@ -615,20 +619,20 @@ 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))
-    {
-      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-                 "No handler for message of type %u found\n",
-                 (unsigned int)client->warn_type);
-      GNUNET_SERVICE_client_continue(client);
-      return; /* ignore error */
-    }
-  GNUNET_SERVICE_client_drop(client);
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "No handler for message of type %u found\n",
+                (unsigned int) client->warn_type);
+    GNUNET_SERVICE_client_continue (client);
+    return;   /* ignore error */
+  }
+  GNUNET_SERVICE_client_drop (client);
 }
 
 
@@ -638,24 +642,24 @@ service_mq_error_handler(void *cls, enum GNUNET_MQ_Error 
error)
  * @param cls our `struct GNUNET_SERVICE_Client *` to process more requests 
from
  */
 static void
-warn_no_client_continue(void *cls)
+warn_no_client_continue (void *cls)
 {
   struct GNUNET_SERVICE_Client *client = cls;
 
-  GNUNET_break(
+  GNUNET_break (
     0 !=
     client->warn_type); /* type should never be 0 here, as we don't use 0 */
-  client->warn_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_MINUTES,
-                                                   &warn_no_client_continue,
-                                                   client);
-  LOG(
+  client->warn_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
+                                                    &warn_no_client_continue,
+                                                    client);
+  LOG (
     GNUNET_ERROR_TYPE_WARNING,
-    _(
+    _ (
       "Processing code for message of type %u did not call 
`GNUNET_SERVICE_client_continue' after %s\n"),
-    (unsigned int)client->warn_type,
-    GNUNET_STRINGS_relative_time_to_string(GNUNET_TIME_absolute_get_duration(
-                                             client->warn_start),
-                                           GNUNET_YES));
+    (unsigned int) client->warn_type,
+    GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (
+                                              client->warn_start),
+                                            GNUNET_YES));
 }
 
 
@@ -671,23 +675,23 @@ warn_no_client_continue(void *cls)
  * @return #GNUNET_OK on success, #GNUNET_SYSERR if the client was dropped
  */
 static int
-service_client_mst_cb(void *cls, const struct GNUNET_MessageHeader *message)
+service_client_mst_cb (void *cls, const struct GNUNET_MessageHeader *message)
 {
   struct GNUNET_SERVICE_Client *client = cls;
 
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "Received message of type %u and size %u from client\n",
-      ntohs(message->type),
-      ntohs(message->size));
-  GNUNET_assert(GNUNET_NO == client->needs_continue);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Received message of type %u and size %u from client\n",
+       ntohs (message->type),
+       ntohs (message->size));
+  GNUNET_assert (GNUNET_NO == client->needs_continue);
   client->needs_continue = GNUNET_YES;
-  client->warn_type = ntohs(message->type);
-  client->warn_start = GNUNET_TIME_absolute_get();
-  GNUNET_assert(NULL == client->warn_task);
-  client->warn_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_MINUTES,
-                                                   &warn_no_client_continue,
-                                                   client);
-  GNUNET_MQ_inject_message(client->mq, message);
+  client->warn_type = ntohs (message->type);
+  client->warn_start = GNUNET_TIME_absolute_get ();
+  GNUNET_assert (NULL == client->warn_task);
+  client->warn_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
+                                                    &warn_no_client_continue,
+                                                    client);
+  GNUNET_MQ_inject_message (client->mq, message);
   if (NULL != client->drop_task)
     return GNUNET_SYSERR;
   return GNUNET_OK;
@@ -701,37 +705,37 @@ service_client_mst_cb(void *cls, const struct 
GNUNET_MessageHeader *message)
  * @param cls the `struct GNUNET_SERVICE_Client` that sent us data.
  */
 static void
-service_client_recv(void *cls)
+service_client_recv (void *cls)
 {
   struct GNUNET_SERVICE_Client *client = cls;
   int ret;
 
   client->recv_task = NULL;
-  ret = GNUNET_MST_read(client->mst, client->sock, GNUNET_NO, GNUNET_YES);
+  ret = GNUNET_MST_read (client->mst, client->sock, GNUNET_NO, GNUNET_YES);
   if (GNUNET_SYSERR == ret)
+  {
+    /* client closed connection (or IO error) */
+    if (NULL == client->drop_task)
     {
-      /* client closed connection (or IO error) */
-      if (NULL == client->drop_task)
-        {
-          GNUNET_assert(GNUNET_NO == client->needs_continue);
-          GNUNET_SERVICE_client_drop(client);
-        }
-      return;
+      GNUNET_assert (GNUNET_NO == client->needs_continue);
+      GNUNET_SERVICE_client_drop (client);
     }
+    return;
+  }
   if (GNUNET_NO == ret)
     return; /* more messages in buffer, wait for application
                to be done processing */
-  GNUNET_assert(GNUNET_OK == ret);
+  GNUNET_assert (GNUNET_OK == ret);
   if (GNUNET_YES == client->needs_continue)
     return;
   if (NULL != client->recv_task)
     return;
   /* MST needs more data, re-schedule read job */
   client->recv_task =
-    GNUNET_SCHEDULER_add_read_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                  client->sock,
-                                  &service_client_recv,
-                                  client);
+    GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                   client->sock,
+                                   &service_client_recv,
+                                   client);
 }
 
 
@@ -743,31 +747,31 @@ service_client_recv(void *cls)
  * @param sock socket associated with the client
  */
 static void
-start_client(struct GNUNET_SERVICE_Handle *sh,
-             struct GNUNET_NETWORK_Handle *csock)
+start_client (struct GNUNET_SERVICE_Handle *sh,
+              struct GNUNET_NETWORK_Handle *csock)
 {
   struct GNUNET_SERVICE_Client *client;
 
-  client = GNUNET_new(struct GNUNET_SERVICE_Client);
-  GNUNET_CONTAINER_DLL_insert(sh->clients_head, sh->clients_tail, client);
+  client = GNUNET_new (struct GNUNET_SERVICE_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,
-                                             NULL,
-                                             &service_mq_cancel,
-                                             client,
-                                             sh->handlers,
-                                             &service_mq_error_handler,
-                                             client);
-  client->mst = GNUNET_MST_create(&service_client_mst_cb, client);
+  client->mq = GNUNET_MQ_queue_for_callbacks (&service_mq_send,
+                                              NULL,
+                                              &service_mq_cancel,
+                                              client,
+                                              sh->handlers,
+                                              &service_mq_error_handler,
+                                              client);
+  client->mst = GNUNET_MST_create (&service_client_mst_cb, client);
   if (NULL != sh->connect_cb)
-    client->user_context = sh->connect_cb(sh->cb_cls, client, client->mq);
-  GNUNET_MQ_set_handlers_closure(client->mq, client->user_context);
+    client->user_context = sh->connect_cb (sh->cb_cls, client, client->mq);
+  GNUNET_MQ_set_handlers_closure (client->mq, client->user_context);
   client->recv_task =
-    GNUNET_SCHEDULER_add_read_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                  client->sock,
-                                  &service_client_recv,
-                                  client);
+    GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                   client->sock,
+                                   &service_client_recv,
+                                   client);
 }
 
 
@@ -778,83 +782,83 @@ start_client(struct GNUNET_SERVICE_Handle *sh,
  * @param cls the `struct ServiceListenContext` of the ready listen socket
  */
 static void
-accept_client(void *cls)
+accept_client (void *cls)
 {
   struct ServiceListenContext *slc = cls;
   struct GNUNET_SERVICE_Handle *sh = slc->sh;
 
   slc->listen_task = NULL;
   while (1)
+  {
+    struct GNUNET_NETWORK_Handle *sock;
+    const struct sockaddr_in *v4;
+    const struct sockaddr_in6 *v6;
+    struct sockaddr_storage sa;
+    socklen_t addrlen;
+    int ok;
+
+    addrlen = sizeof(sa);
+    sock = GNUNET_NETWORK_socket_accept (slc->listen_socket,
+                                         (struct sockaddr *) &sa,
+                                         &addrlen);
+    if (NULL == sock)
+    {
+      if (EMFILE == errno)
+        do_suspend (sh, SUSPEND_STATE_EMFILE);
+      else if (EAGAIN != errno)
+        GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "accept");
+      break;
+    }
+    switch (sa.ss_family)
     {
-      struct GNUNET_NETWORK_Handle *sock;
-      const struct sockaddr_in *v4;
-      const struct sockaddr_in6 *v6;
-      struct sockaddr_storage sa;
-      socklen_t addrlen;
-      int ok;
-
-      addrlen = sizeof(sa);
-      sock = GNUNET_NETWORK_socket_accept(slc->listen_socket,
-                                          (struct sockaddr *)&sa,
-                                          &addrlen);
-      if (NULL == sock)
-        {
-          if (EMFILE == errno)
-            do_suspend(sh, SUSPEND_STATE_EMFILE);
-          else if (EAGAIN != errno)
-            GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, "accept");
-          break;
-        }
-      switch (sa.ss_family)
-        {
-        case AF_INET:
-          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))) &&
-                ((NULL == sh->v4_denied) ||
-                 (!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))) &&
-                ((NULL == sh->v6_denied) ||
-                 (!check_ipv6_listed(sh->v6_denied, &v6->sin6_addr))));
-          break;
-
-        case AF_UNIX:
-          ok = GNUNET_OK; /* controlled using file-system ACL now */
-          break;
-
-        default:
-          LOG(GNUNET_ERROR_TYPE_WARNING,
-              _("Unknown address family %d\n"),
-              sa.ss_family);
-          return;
-        }
-      if (!ok)
-        {
-          LOG(GNUNET_ERROR_TYPE_DEBUG,
-              "Service rejected incoming connection from %s due to policy.\n",
-              GNUNET_a2s((const struct sockaddr *)&sa, addrlen));
-          GNUNET_break(GNUNET_OK == GNUNET_NETWORK_socket_close(sock));
-          continue;
-        }
-      LOG(GNUNET_ERROR_TYPE_DEBUG,
-          "Service accepted incoming connection from %s.\n",
-          GNUNET_a2s((const struct sockaddr *)&sa, addrlen));
-      start_client(slc->sh, sock);
+    case AF_INET:
+      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))) &&
+            ((NULL == sh->v4_denied) ||
+             (! 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))) &&
+            ((NULL == sh->v6_denied) ||
+             (! check_ipv6_listed (sh->v6_denied, &v6->sin6_addr))));
+      break;
+
+    case AF_UNIX:
+      ok = GNUNET_OK;     /* controlled using file-system ACL now */
+      break;
+
+    default:
+      LOG (GNUNET_ERROR_TYPE_WARNING,
+           _ ("Unknown address family %d\n"),
+           sa.ss_family);
+      return;
+    }
+    if (! ok)
+    {
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "Service rejected incoming connection from %s due to policy.\n",
+           GNUNET_a2s ((const struct sockaddr *) &sa, addrlen));
+      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
+      continue;
     }
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Service accepted incoming connection from %s.\n",
+         GNUNET_a2s ((const struct sockaddr *) &sa, addrlen));
+    start_client (slc->sh, sock);
+  }
   if (0 != sh->suspend_state)
     return;
   slc->listen_task =
-    GNUNET_SCHEDULER_add_read_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                  slc->listen_socket,
-                                  &accept_client,
-                                  slc);
+    GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                   slc->listen_socket,
+                                   &accept_client,
+                                   slc);
 }
 
 
@@ -866,23 +870,23 @@ 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)));
+  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)
-    {
-      GNUNET_assert(NULL == slc->listen_task);
-      slc->listen_task =
-        GNUNET_SCHEDULER_add_read_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                      slc->listen_socket,
-                                      &accept_client,
-                                      slc);
-    }
+  {
+    GNUNET_assert (NULL == slc->listen_task);
+    slc->listen_task =
+      GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                     slc->listen_socket,
+                                     &accept_client,
+                                     slc);
+  }
 }
 
 
@@ -894,23 +898,23 @@ do_resume(struct GNUNET_SERVICE_Handle *sh, enum 
SuspendReason sr)
  * @param cls our `struct GNUNET_SERVICE_Handle`
  */
 static void
-service_main(void *cls)
+service_main (void *cls)
 {
   struct GNUNET_SERVICE_Handle *sh = cls;
 
   if (GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN != sh->options)
-    GNUNET_SCHEDULER_add_shutdown(&service_shutdown, sh);
-  do_resume(sh, SUSPEND_STATE_NONE);
+    GNUNET_SCHEDULER_add_shutdown (&service_shutdown, sh);
+  do_resume (sh, SUSPEND_STATE_NONE);
 
   if (-1 != sh->ready_confirm_fd)
-    {
-      GNUNET_break(1 == write(sh->ready_confirm_fd, ".", 1));
-      GNUNET_break(0 == close(sh->ready_confirm_fd));
-      sh->ready_confirm_fd = -1;
-    }
+  {
+    GNUNET_break (1 == write (sh->ready_confirm_fd, ".", 1));
+    GNUNET_break (0 == close (sh->ready_confirm_fd));
+    sh->ready_confirm_fd = -1;
+  }
 
   if (NULL != sh->service_init_cb)
-    sh->service_init_cb(sh->cb_cls, sh->cfg, sh);
+    sh->service_init_cb (sh->cb_cls, sh->cfg, sh);
 }
 
 
@@ -924,33 +928,33 @@ service_main(void *cls)
  *         no ACL configured)
  */
 static int
-process_acl4(struct GNUNET_STRINGS_IPv4NetworkPolicy **ret,
-             struct GNUNET_SERVICE_Handle *sh,
-             const char *option)
+process_acl4 (struct GNUNET_STRINGS_IPv4NetworkPolicy **ret,
+              struct GNUNET_SERVICE_Handle *sh,
+              const char *option)
 {
   char *opt;
 
-  if (!GNUNET_CONFIGURATION_have_value(sh->cfg, sh->service_name, option))
-    {
-      *ret = NULL;
-      return GNUNET_OK;
-    }
-  GNUNET_break(GNUNET_OK ==
-               GNUNET_CONFIGURATION_get_value_string(sh->cfg,
-                                                     sh->service_name,
-                                                     option,
-                                                     &opt));
-  if (NULL == (*ret = GNUNET_STRINGS_parse_ipv4_policy(opt)))
-    {
-      LOG(GNUNET_ERROR_TYPE_WARNING,
-          _("Could not parse IPv4 network specification `%s' for `%s:%s'\n"),
-          opt,
-          sh->service_name,
-          option);
-      GNUNET_free(opt);
-      return GNUNET_SYSERR;
-    }
-  GNUNET_free(opt);
+  if (! GNUNET_CONFIGURATION_have_value (sh->cfg, sh->service_name, option))
+  {
+    *ret = NULL;
+    return GNUNET_OK;
+  }
+  GNUNET_break (GNUNET_OK ==
+                GNUNET_CONFIGURATION_get_value_string (sh->cfg,
+                                                       sh->service_name,
+                                                       option,
+                                                       &opt));
+  if (NULL == (*ret = GNUNET_STRINGS_parse_ipv4_policy (opt)))
+  {
+    LOG (GNUNET_ERROR_TYPE_WARNING,
+         _ ("Could not parse IPv4 network specification `%s' for `%s:%s'\n"),
+         opt,
+         sh->service_name,
+         option);
+    GNUNET_free (opt);
+    return GNUNET_SYSERR;
+  }
+  GNUNET_free (opt);
   return GNUNET_OK;
 }
 
@@ -965,33 +969,33 @@ process_acl4(struct GNUNET_STRINGS_IPv4NetworkPolicy 
**ret,
  *         no ACL configured)
  */
 static int
-process_acl6(struct GNUNET_STRINGS_IPv6NetworkPolicy **ret,
-             struct GNUNET_SERVICE_Handle *sh,
-             const char *option)
+process_acl6 (struct GNUNET_STRINGS_IPv6NetworkPolicy **ret,
+              struct GNUNET_SERVICE_Handle *sh,
+              const char *option)
 {
   char *opt;
 
-  if (!GNUNET_CONFIGURATION_have_value(sh->cfg, sh->service_name, option))
-    {
-      *ret = NULL;
-      return GNUNET_OK;
-    }
-  GNUNET_break(GNUNET_OK ==
-               GNUNET_CONFIGURATION_get_value_string(sh->cfg,
-                                                     sh->service_name,
-                                                     option,
-                                                     &opt));
-  if (NULL == (*ret = GNUNET_STRINGS_parse_ipv6_policy(opt)))
-    {
-      LOG(GNUNET_ERROR_TYPE_WARNING,
-          _("Could not parse IPv6 network specification `%s' for `%s:%s'\n"),
-          opt,
-          sh->service_name,
-          option);
-      GNUNET_free(opt);
-      return GNUNET_SYSERR;
-    }
-  GNUNET_free(opt);
+  if (! GNUNET_CONFIGURATION_have_value (sh->cfg, sh->service_name, option))
+  {
+    *ret = NULL;
+    return GNUNET_OK;
+  }
+  GNUNET_break (GNUNET_OK ==
+                GNUNET_CONFIGURATION_get_value_string (sh->cfg,
+                                                       sh->service_name,
+                                                       option,
+                                                       &opt));
+  if (NULL == (*ret = GNUNET_STRINGS_parse_ipv6_policy (opt)))
+  {
+    LOG (GNUNET_ERROR_TYPE_WARNING,
+         _ ("Could not parse IPv6 network specification `%s' for `%s:%s'\n"),
+         opt,
+         sh->service_name,
+         option);
+    GNUNET_free (opt);
+    return GNUNET_SYSERR;
+  }
+  GNUNET_free (opt);
   return GNUNET_OK;
 }
 
@@ -1003,34 +1007,27 @@ process_acl6(struct GNUNET_STRINGS_IPv6NetworkPolicy 
**ret,
  * @param saddrs array to update
  * @param saddrlens where to store the address length
  * @param unixpath path to add
- * @param abstract #GNUNET_YES to add an abstract UNIX domain socket.  This
- *          parameter is ignore on systems other than LINUX
  */
 static void
-add_unixpath(struct sockaddr **saddrs,
-             socklen_t *saddrlens,
-             const char *unixpath,
-             int abstract)
+add_unixpath (struct sockaddr **saddrs,
+              socklen_t *saddrlens,
+              const char *unixpath)
 {
 #ifdef AF_UNIX
   struct sockaddr_un *un;
 
-  un = GNUNET_new(struct sockaddr_un);
+  un = GNUNET_new (struct sockaddr_un);
   un->sun_family = AF_UNIX;
-  GNUNET_strlcpy(un->sun_path, unixpath, sizeof(un->sun_path));
-#ifdef LINUX
-  if (GNUNET_YES == abstract)
-    un->sun_path[0] = '\0';
-#endif
+  GNUNET_strlcpy (un->sun_path, unixpath, sizeof(un->sun_path));
 #if HAVE_SOCKADDR_UN_SUN_LEN
-  un->sun_len = (u_char)sizeof(struct sockaddr_un);
+  un->sun_len = (u_char) sizeof(struct sockaddr_un);
 #endif
-  *saddrs = (struct sockaddr *)un;
+  *saddrs = (struct sockaddr *) un;
   *saddrlens = sizeof(struct sockaddr_un);
 #else
   /* this function should never be called
    * unless AF_UNIX is defined! */
-  GNUNET_assert(0);
+  GNUNET_assert (0);
 #endif
 }
 
@@ -1056,10 +1053,10 @@ add_unixpath(struct sockaddr **saddrs,
  *              set to NULL).
  */
 static int
-get_server_addresses(const char *service_name,
-                     const struct GNUNET_CONFIGURATION_Handle *cfg,
-                     struct sockaddr ***addrs,
-                     socklen_t **addr_lens)
+get_server_addresses (const char *service_name,
+                      const struct GNUNET_CONFIGURATION_Handle *cfg,
+                      struct sockaddr ***addrs,
+                      socklen_t **addr_lens)
 {
   int disablev6;
   struct GNUNET_NETWORK_Handle *desc;
@@ -1072,7 +1069,6 @@ get_server_addresses(const char *service_name,
   unsigned int i;
   int resi;
   int ret;
-  int abstract;
   struct sockaddr **saddrs;
   socklen_t *saddrlens;
   char *hostname;
@@ -1081,273 +1077,264 @@ get_server_addresses(const char *service_name,
   *addr_lens = NULL;
   desc = NULL;
   disablev6 = GNUNET_NO;
-  if ((GNUNET_NO == GNUNET_NETWORK_test_pf(PF_INET6)) ||
+  if ((GNUNET_NO == GNUNET_NETWORK_test_pf (PF_INET6)) ||
       (GNUNET_YES ==
-       GNUNET_CONFIGURATION_get_value_yesno(cfg, service_name, "DISABLEV6")))
+       GNUNET_CONFIGURATION_get_value_yesno (cfg, service_name, "DISABLEV6")))
     disablev6 = GNUNET_YES;
 
   port = 0;
-  if (GNUNET_CONFIGURATION_have_value(cfg, service_name, "PORT"))
+  if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT"))
+  {
+    if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
+                                                            service_name,
+                                                            "PORT",
+                                                            &port))
     {
-      if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number(cfg,
-                                                             service_name,
-                                                             "PORT",
-                                                             &port))
-        {
-          LOG(GNUNET_ERROR_TYPE_ERROR,
-              _("Require valid port number for service `%s' in 
configuration!\n"),
-              service_name);
-        }
-      if (port > 65535)
-        {
-          LOG(GNUNET_ERROR_TYPE_ERROR,
-              _("Require valid port number for service `%s' in 
configuration!\n"),
-              service_name);
-          return GNUNET_SYSERR;
-        }
+      LOG (GNUNET_ERROR_TYPE_ERROR,
+           _ ("Require valid port number for service `%s' in 
configuration!\n"),
+           service_name);
     }
-
-  if (GNUNET_CONFIGURATION_have_value(cfg, service_name, "BINDTO"))
+    if (port > 65535)
     {
-      GNUNET_break(GNUNET_OK ==
-                   GNUNET_CONFIGURATION_get_value_string(cfg,
+      LOG (GNUNET_ERROR_TYPE_ERROR,
+           _ ("Require valid port number for service `%s' in 
configuration!\n"),
+           service_name);
+      return GNUNET_SYSERR;
+    }
+  }
+
+  if (GNUNET_CONFIGURATION_have_value (cfg, service_name, "BINDTO"))
+  {
+    GNUNET_break (GNUNET_OK ==
+                  GNUNET_CONFIGURATION_get_value_string (cfg,
                                                          service_name,
                                                          "BINDTO",
                                                          &hostname));
-    }
+  }
   else
     hostname = NULL;
 
   unixpath = NULL;
-  abstract = GNUNET_NO;
 #ifdef AF_UNIX
   if ((GNUNET_YES ==
-       GNUNET_CONFIGURATION_have_value(cfg, service_name, "UNIXPATH")) &&
-      (GNUNET_OK == GNUNET_CONFIGURATION_get_value_filename(cfg,
-                                                            service_name,
-                                                            "UNIXPATH",
-                                                            &unixpath)) &&
-      (0 < strlen(unixpath)))
+       GNUNET_CONFIGURATION_have_value (cfg, service_name, "UNIXPATH")) &&
+      (GNUNET_OK == GNUNET_CONFIGURATION_get_value_filename (cfg,
+                                                             service_name,
+                                                             "UNIXPATH",
+                                                             &unixpath)) &&
+      (0 < strlen (unixpath)))
+  {
+    /* probe UNIX support */
+    struct sockaddr_un s_un;
+
+    if (strlen (unixpath) >= sizeof(s_un.sun_path))
     {
-      /* probe UNIX support */
-      struct sockaddr_un s_un;
-
-      if (strlen(unixpath) >= sizeof(s_un.sun_path))
-        {
-          LOG(GNUNET_ERROR_TYPE_WARNING,
-              _("UNIXPATH `%s' too long, maximum length is %llu\n"),
-              unixpath,
-              (unsigned long long)sizeof(s_un.sun_path));
-          unixpath = GNUNET_NETWORK_shorten_unixpath(unixpath);
-          LOG(GNUNET_ERROR_TYPE_INFO, _("Using `%s' instead\n"), unixpath);
-        }
-#ifdef LINUX
-      abstract = GNUNET_CONFIGURATION_get_value_yesno(cfg,
-                                                      "TESTING",
-                                                      "USE_ABSTRACT_SOCKETS");
-      if (GNUNET_SYSERR == abstract)
-        abstract = GNUNET_NO;
-#endif
-      if ((GNUNET_YES != abstract) &&
-          (GNUNET_OK != GNUNET_DISK_directory_create_for_file(unixpath)))
-        GNUNET_log_strerror_file(GNUNET_ERROR_TYPE_ERROR, "mkdir", unixpath);
+      LOG (GNUNET_ERROR_TYPE_WARNING,
+           _ ("UNIXPATH `%s' too long, maximum length is %llu\n"),
+           unixpath,
+           (unsigned long long) sizeof(s_un.sun_path));
+      unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath);
+      LOG (GNUNET_ERROR_TYPE_INFO, _ ("Using `%s' instead\n"), unixpath);
     }
+    if (GNUNET_OK != GNUNET_DISK_directory_create_for_file (unixpath))
+      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "mkdir", unixpath);
+  }
   if (NULL != unixpath)
+  {
+    desc = GNUNET_NETWORK_socket_create (AF_UNIX, SOCK_STREAM, 0);
+    if (NULL == desc)
     {
-      desc = GNUNET_NETWORK_socket_create(AF_UNIX, SOCK_STREAM, 0);
-      if (NULL == desc)
-        {
-          if ((ENOBUFS == errno) || (ENOMEM == errno) || (ENFILE == errno) ||
-              (EACCES == errno))
-            {
-              LOG_STRERROR(GNUNET_ERROR_TYPE_ERROR, "socket");
-              GNUNET_free_non_null(hostname);
-              GNUNET_free(unixpath);
-              return GNUNET_SYSERR;
-            }
-          LOG(GNUNET_ERROR_TYPE_INFO,
-              _(
-                "Disabling UNIX domain socket support for service `%s', failed 
to create UNIX domain socket: %s\n"),
-              service_name,
-              strerror(errno));
-          GNUNET_free(unixpath);
-          unixpath = NULL;
-        }
-      else
-        {
-          GNUNET_break(GNUNET_OK == GNUNET_NETWORK_socket_close(desc));
-          desc = NULL;
-        }
+      if ((ENOBUFS == errno) || (ENOMEM == errno) || (ENFILE == errno) ||
+          (EACCES == errno))
+      {
+        LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "socket");
+        GNUNET_free_non_null (hostname);
+        GNUNET_free (unixpath);
+        return GNUNET_SYSERR;
+      }
+      LOG (GNUNET_ERROR_TYPE_INFO,
+           _ (
+             "Disabling UNIX domain socket support for service `%s', failed to 
create UNIX domain socket: %s\n"),
+           service_name,
+           strerror (errno));
+      GNUNET_free (unixpath);
+      unixpath = NULL;
+    }
+    else
+    {
+      GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (desc));
+      desc = NULL;
     }
+  }
 #endif
 
   if ((0 == port) && (NULL == unixpath))
+  {
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+         _ (
+           "Have neither PORT nor UNIXPATH for service `%s', but one is 
required\n"),
+         service_name);
+    GNUNET_free_non_null (hostname);
+    return GNUNET_SYSERR;
+  }
+  if (0 == port)
+  {
+    saddrs = GNUNET_new_array (2, struct sockaddr *);
+    saddrlens = GNUNET_new_array (2, socklen_t);
+    add_unixpath (saddrs, saddrlens, unixpath);
+    GNUNET_free_non_null (unixpath);
+    GNUNET_free_non_null (hostname);
+    *addrs = saddrs;
+    *addr_lens = saddrlens;
+    return 1;
+  }
+
+  if (NULL != hostname)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Resolving `%s' since that is where `%s' will bind to.\n",
+         hostname,
+         service_name);
+    memset (&hints, 0, sizeof(struct addrinfo));
+    if (disablev6)
+      hints.ai_family = AF_INET;
+    hints.ai_protocol = IPPROTO_TCP;
+    if ((0 != (ret = getaddrinfo (hostname, NULL, &hints, &res))) ||
+        (NULL == res))
     {
-      LOG(GNUNET_ERROR_TYPE_ERROR,
-          _(
-            "Have neither PORT nor UNIXPATH for service `%s', but one is 
required\n"),
-          service_name);
-      GNUNET_free_non_null(hostname);
+      LOG (GNUNET_ERROR_TYPE_ERROR,
+           _ ("Failed to resolve `%s': %s\n"),
+           hostname,
+           gai_strerror (ret));
+      GNUNET_free (hostname);
+      GNUNET_free_non_null (unixpath);
       return GNUNET_SYSERR;
     }
-  if (0 == port)
+    next = res;
+    i = 0;
+    while (NULL != (pos = next))
     {
-      saddrs = GNUNET_new_array(2, struct sockaddr *);
-      saddrlens = GNUNET_new_array(2, socklen_t);
-      add_unixpath(saddrs, saddrlens, unixpath, abstract);
-      GNUNET_free_non_null(unixpath);
-      GNUNET_free_non_null(hostname);
-      *addrs = saddrs;
-      *addr_lens = saddrlens;
-      return 1;
+      next = pos->ai_next;
+      if ((disablev6) && (pos->ai_family == AF_INET6))
+        continue;
+      i++;
     }
-
-  if (NULL != hostname)
+    if (0 == i)
     {
-      LOG(GNUNET_ERROR_TYPE_DEBUG,
-          "Resolving `%s' since that is where `%s' will bind to.\n",
-          hostname,
-          service_name);
-      memset(&hints, 0, sizeof(struct addrinfo));
-      if (disablev6)
-        hints.ai_family = AF_INET;
-      hints.ai_protocol = IPPROTO_TCP;
-      if ((0 != (ret = getaddrinfo(hostname, NULL, &hints, &res))) ||
-          (NULL == res))
-        {
-          LOG(GNUNET_ERROR_TYPE_ERROR,
-              _("Failed to resolve `%s': %s\n"),
-              hostname,
-              gai_strerror(ret));
-          GNUNET_free(hostname);
-          GNUNET_free_non_null(unixpath);
-          return GNUNET_SYSERR;
-        }
-      next = res;
-      i = 0;
-      while (NULL != (pos = next))
-        {
-          next = pos->ai_next;
-          if ((disablev6) && (pos->ai_family == AF_INET6))
-            continue;
-          i++;
-        }
-      if (0 == i)
-        {
-          LOG(GNUNET_ERROR_TYPE_ERROR,
-              _("Failed to find %saddress for `%s'.\n"),
-              disablev6 ? "IPv4 " : "",
-              hostname);
-          freeaddrinfo(res);
-          GNUNET_free(hostname);
-          GNUNET_free_non_null(unixpath);
-          return GNUNET_SYSERR;
-        }
-      resi = i;
+      LOG (GNUNET_ERROR_TYPE_ERROR,
+           _ ("Failed to find %saddress for `%s'.\n"),
+           disablev6 ? "IPv4 " : "",
+           hostname);
+      freeaddrinfo (res);
+      GNUNET_free (hostname);
+      GNUNET_free_non_null (unixpath);
+      return GNUNET_SYSERR;
+    }
+    resi = i;
+    if (NULL != unixpath)
+      resi++;
+    saddrs = GNUNET_new_array (resi + 1, struct sockaddr *);
+    saddrlens = GNUNET_new_array (resi + 1, socklen_t);
+    i = 0;
+    if (NULL != unixpath)
+    {
+      add_unixpath (saddrs, saddrlens, unixpath);
+      i++;
+    }
+    next = res;
+    while (NULL != (pos = next))
+    {
+      next = pos->ai_next;
+      if ((disablev6) && (AF_INET6 == pos->ai_family))
+        continue;
+      if ((IPPROTO_TCP != pos->ai_protocol) && (0 != pos->ai_protocol))
+        continue;     /* not TCP */
+      if ((SOCK_STREAM != pos->ai_socktype) && (0 != pos->ai_socktype))
+        continue;     /* huh? */
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "Service `%s' will bind to `%s'\n",
+           service_name,
+           GNUNET_a2s (pos->ai_addr, pos->ai_addrlen));
+      if (AF_INET == pos->ai_family)
+      {
+        GNUNET_assert (sizeof(struct sockaddr_in) == pos->ai_addrlen);
+        saddrlens[i] = pos->ai_addrlen;
+        saddrs[i] = GNUNET_malloc (saddrlens[i]);
+        GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
+        ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
+      }
+      else
+      {
+        GNUNET_assert (AF_INET6 == pos->ai_family);
+        GNUNET_assert (sizeof(struct sockaddr_in6) == pos->ai_addrlen);
+        saddrlens[i] = pos->ai_addrlen;
+        saddrs[i] = GNUNET_malloc (saddrlens[i]);
+        GNUNET_memcpy (saddrs[i], pos->ai_addr, saddrlens[i]);
+        ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
+      }
+      i++;
+    }
+    GNUNET_free (hostname);
+    freeaddrinfo (res);
+    resi = i;
+  }
+  else
+  {
+    /* will bind against everything, just set port */
+    if (disablev6)
+    {
+      /* V4-only */
+      resi = 1;
       if (NULL != unixpath)
         resi++;
-      saddrs = GNUNET_new_array(resi + 1, struct sockaddr *);
-      saddrlens = GNUNET_new_array(resi + 1, socklen_t);
       i = 0;
+      saddrs = GNUNET_new_array (resi + 1, struct sockaddr *);
+      saddrlens = GNUNET_new_array (resi + 1, socklen_t);
       if (NULL != unixpath)
-        {
-          add_unixpath(saddrs, saddrlens, unixpath, abstract);
-          i++;
-        }
-      next = res;
-      while (NULL != (pos = next))
-        {
-          next = pos->ai_next;
-          if ((disablev6) && (AF_INET6 == pos->ai_family))
-            continue;
-          if ((IPPROTO_TCP != pos->ai_protocol) && (0 != pos->ai_protocol))
-            continue; /* not TCP */
-          if ((SOCK_STREAM != pos->ai_socktype) && (0 != pos->ai_socktype))
-            continue; /* huh? */
-          LOG(GNUNET_ERROR_TYPE_DEBUG,
-              "Service `%s' will bind to `%s'\n",
-              service_name,
-              GNUNET_a2s(pos->ai_addr, pos->ai_addrlen));
-          if (AF_INET == pos->ai_family)
-            {
-              GNUNET_assert(sizeof(struct sockaddr_in) == pos->ai_addrlen);
-              saddrlens[i] = pos->ai_addrlen;
-              saddrs[i] = GNUNET_malloc(saddrlens[i]);
-              GNUNET_memcpy(saddrs[i], pos->ai_addr, saddrlens[i]);
-              ((struct sockaddr_in *)saddrs[i])->sin_port = htons(port);
-            }
-          else
-            {
-              GNUNET_assert(AF_INET6 == pos->ai_family);
-              GNUNET_assert(sizeof(struct sockaddr_in6) == pos->ai_addrlen);
-              saddrlens[i] = pos->ai_addrlen;
-              saddrs[i] = GNUNET_malloc(saddrlens[i]);
-              GNUNET_memcpy(saddrs[i], pos->ai_addr, saddrlens[i]);
-              ((struct sockaddr_in6 *)saddrs[i])->sin6_port = htons(port);
-            }
-          i++;
-        }
-      GNUNET_free(hostname);
-      freeaddrinfo(res);
-      resi = i;
-    }
-  else
-    {
-      /* will bind against everything, just set port */
-      if (disablev6)
-        {
-          /* V4-only */
-          resi = 1;
-          if (NULL != unixpath)
-            resi++;
-          i = 0;
-          saddrs = GNUNET_new_array(resi + 1, struct sockaddr *);
-          saddrlens = GNUNET_new_array(resi + 1, socklen_t);
-          if (NULL != unixpath)
-            {
-              add_unixpath(saddrs, saddrlens, unixpath, abstract);
-              i++;
-            }
-          saddrlens[i] = sizeof(struct sockaddr_in);
-          saddrs[i] = GNUNET_malloc(saddrlens[i]);
+      {
+        add_unixpath (saddrs, saddrlens, unixpath);
+        i++;
+      }
+      saddrlens[i] = sizeof(struct sockaddr_in);
+      saddrs[i] = GNUNET_malloc (saddrlens[i]);
 #if HAVE_SOCKADDR_IN_SIN_LEN
-          ((struct sockaddr_in *)saddrs[i])->sin_len = saddrlens[i];
+      ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[i];
 #endif
-          ((struct sockaddr_in *)saddrs[i])->sin_family = AF_INET;
-          ((struct sockaddr_in *)saddrs[i])->sin_port = htons(port);
-        }
-      else
-        {
-          /* dual stack */
-          resi = 2;
-          if (NULL != unixpath)
-            resi++;
-          saddrs = GNUNET_new_array(resi + 1, struct sockaddr *);
-          saddrlens = GNUNET_new_array(resi + 1, socklen_t);
-          i = 0;
-          if (NULL != unixpath)
-            {
-              add_unixpath(saddrs, saddrlens, unixpath, abstract);
-              i++;
-            }
-          saddrlens[i] = sizeof(struct sockaddr_in6);
-          saddrs[i] = GNUNET_malloc(saddrlens[i]);
+      ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET;
+      ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
+    }
+    else
+    {
+      /* dual stack */
+      resi = 2;
+      if (NULL != unixpath)
+        resi++;
+      saddrs = GNUNET_new_array (resi + 1, struct sockaddr *);
+      saddrlens = GNUNET_new_array (resi + 1, socklen_t);
+      i = 0;
+      if (NULL != unixpath)
+      {
+        add_unixpath (saddrs, saddrlens, unixpath);
+        i++;
+      }
+      saddrlens[i] = sizeof(struct sockaddr_in6);
+      saddrs[i] = GNUNET_malloc (saddrlens[i]);
 #if HAVE_SOCKADDR_IN_SIN_LEN
-          ((struct sockaddr_in6 *)saddrs[i])->sin6_len = saddrlens[0];
+      ((struct sockaddr_in6 *) saddrs[i])->sin6_len = saddrlens[0];
 #endif
-          ((struct sockaddr_in6 *)saddrs[i])->sin6_family = AF_INET6;
-          ((struct sockaddr_in6 *)saddrs[i])->sin6_port = htons(port);
-          i++;
-          saddrlens[i] = sizeof(struct sockaddr_in);
-          saddrs[i] = GNUNET_malloc(saddrlens[i]);
+      ((struct sockaddr_in6 *) saddrs[i])->sin6_family = AF_INET6;
+      ((struct sockaddr_in6 *) saddrs[i])->sin6_port = htons (port);
+      i++;
+      saddrlens[i] = sizeof(struct sockaddr_in);
+      saddrs[i] = GNUNET_malloc (saddrlens[i]);
 #if HAVE_SOCKADDR_IN_SIN_LEN
-          ((struct sockaddr_in *)saddrs[i])->sin_len = saddrlens[1];
+      ((struct sockaddr_in *) saddrs[i])->sin_len = saddrlens[1];
 #endif
-          ((struct sockaddr_in *)saddrs[i])->sin_family = AF_INET;
-          ((struct sockaddr_in *)saddrs[i])->sin_port = htons(port);
-        }
+      ((struct sockaddr_in *) saddrs[i])->sin_family = AF_INET;
+      ((struct sockaddr_in *) saddrs[i])->sin_port = htons (port);
     }
-  GNUNET_free_non_null(unixpath);
+  }
+  GNUNET_free_non_null (unixpath);
   *addrs = saddrs;
   *addr_lens = saddrlens;
   return resi;
@@ -1362,89 +1349,96 @@ get_server_addresses(const char *service_name,
  * @return NULL on error, otherwise the listen socket
  */
 static struct GNUNET_NETWORK_Handle *
-open_listen_socket(const struct sockaddr *server_addr, socklen_t socklen)
+open_listen_socket (const struct sockaddr *server_addr,
+                    socklen_t socklen)
 {
   struct GNUNET_NETWORK_Handle *sock;
   uint16_t port;
   int eno;
 
   switch (server_addr->sa_family)
-    {
-    case AF_INET:
-      port = ntohs(((const struct sockaddr_in *)server_addr)->sin_port);
-      break;
-
-    case AF_INET6:
-      port = ntohs(((const struct sockaddr_in6 *)server_addr)->sin6_port);
-      break;
-
-    case AF_UNIX:
-      port = 0;
-      break;
-
-    default:
-      GNUNET_break(0);
-      port = 0;
-      break;
-    }
-  sock = GNUNET_NETWORK_socket_create(server_addr->sa_family, SOCK_STREAM, 0);
+  {
+  case AF_INET:
+    port = ntohs (((const struct sockaddr_in *) server_addr)->sin_port);
+    break;
+
+  case AF_INET6:
+    port = ntohs (((const struct sockaddr_in6 *) server_addr)->sin6_port);
+    break;
+
+  case AF_UNIX:
+    port = 0;
+    break;
+
+  default:
+    GNUNET_break (0);
+    port = 0;
+    break;
+  }
+  sock = GNUNET_NETWORK_socket_create (server_addr->sa_family,
+                                       SOCK_STREAM,
+                                       0);
   if (NULL == sock)
-    {
-      LOG_STRERROR(GNUNET_ERROR_TYPE_ERROR, "socket");
-      errno = 0;
-      return NULL;
-    }
+  {
+    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
+                  "socket");
+    errno = 0;
+    return NULL;
+  }
   /* bind the socket */
-  if (GNUNET_OK != GNUNET_NETWORK_socket_bind(sock, server_addr, socklen))
+  if (GNUNET_OK !=
+      GNUNET_NETWORK_socket_bind (sock,
+                                  server_addr,
+                                  socklen))
+  {
+    eno = errno;
+    if (EADDRINUSE != errno)
     {
-      eno = errno;
-      if (EADDRINUSE != errno)
-        {
-          /* we don't log 'EADDRINUSE' here since an IPv4 bind may
-           * fail if we already took the port on IPv6; if both IPv4 and
-           * IPv6 binds fail, then our caller will log using the
-           * errno preserved in 'eno' */
-          if (0 != port)
-            LOG(GNUNET_ERROR_TYPE_ERROR,
-                _("`%s' failed for port %d (%s).\n"),
-                "bind",
-                port,
-                (AF_INET == server_addr->sa_family) ? "IPv4" : "IPv6");
-          else
-            LOG_STRERROR(GNUNET_ERROR_TYPE_ERROR, "bind");
-          eno = 0;
-        }
+      /* we don't log 'EADDRINUSE' here since an IPv4 bind may
+       * fail if we already took the port on IPv6; if both IPv4 and
+       * IPv6 binds fail, then our caller will log using the
+       * errno preserved in 'eno' */
+      if (0 != port)
+        LOG (GNUNET_ERROR_TYPE_ERROR,
+             _ ("`%s' failed for port %d (%s).\n"),
+             "bind",
+             port,
+             (AF_INET == server_addr->sa_family) ? "IPv4" : "IPv6");
       else
-        {
-          if (0 != port)
-            LOG(GNUNET_ERROR_TYPE_WARNING,
-                _("`%s' failed for port %d (%s): address already in use\n"),
-                "bind",
-                port,
-                (AF_INET == server_addr->sa_family) ? "IPv4" : "IPv6");
-          else if (AF_UNIX == server_addr->sa_family)
-            {
-              LOG(GNUNET_ERROR_TYPE_WARNING,
-                  _("`%s' failed for `%s': address already in use\n"),
-                  "bind",
-                  GNUNET_a2s(server_addr, socklen));
-            }
-        }
-      GNUNET_break(GNUNET_OK == GNUNET_NETWORK_socket_close(sock));
-      errno = eno;
-      return NULL;
+        LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "bind");
+      eno = 0;
     }
-  if (GNUNET_OK != GNUNET_NETWORK_socket_listen(sock, 5))
+    else
     {
-      LOG_STRERROR(GNUNET_ERROR_TYPE_ERROR, "listen");
-      GNUNET_break(GNUNET_OK == GNUNET_NETWORK_socket_close(sock));
-      errno = 0;
-      return NULL;
+      if (0 != port)
+        LOG (GNUNET_ERROR_TYPE_WARNING,
+             _ ("`%s' failed for port %d (%s): address already in use\n"),
+             "bind",
+             port,
+             (AF_INET == server_addr->sa_family) ? "IPv4" : "IPv6");
+      else if (AF_UNIX == server_addr->sa_family)
+      {
+        LOG (GNUNET_ERROR_TYPE_WARNING,
+             _ ("`%s' failed for `%s': address already in use\n"),
+             "bind",
+             GNUNET_a2s (server_addr, socklen));
+      }
     }
+    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
+    errno = eno;
+    return NULL;
+  }
+  if (GNUNET_OK != GNUNET_NETWORK_socket_listen (sock, 5))
+  {
+    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "listen");
+    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock));
+    errno = 0;
+    return NULL;
+  }
   if (0 != port)
-    LOG(GNUNET_ERROR_TYPE_DEBUG,
-        "Server starts to listen on port %u.\n",
-        port);
+    LOG (GNUNET_ERROR_TYPE_DEBUG,
+         "Server starts to listen on port %u.\n",
+         port);
   return sock;
 }
 
@@ -1466,7 +1460,7 @@ open_listen_socket(const struct sockaddr *server_addr, 
socklen_t socklen)
  * @return #GNUNET_OK if configuration succeeded
  */
 static int
-setup_service(struct GNUNET_SERVICE_Handle *sh)
+setup_service (struct GNUNET_SERVICE_Handle *sh)
 {
   int tolerant;
   struct GNUNET_NETWORK_Handle **lsocks;
@@ -1475,119 +1469,119 @@ setup_service(struct GNUNET_SERVICE_Handle *sh)
   int flags;
   char dummy[2];
 
-  if (GNUNET_CONFIGURATION_have_value(sh->cfg, sh->service_name, "TOLERANT"))
+  if (GNUNET_CONFIGURATION_have_value (sh->cfg, sh->service_name, "TOLERANT"))
+  {
+    if (GNUNET_SYSERR ==
+        (tolerant = GNUNET_CONFIGURATION_get_value_yesno (sh->cfg,
+                                                          sh->service_name,
+                                                          "TOLERANT")))
     {
-      if (GNUNET_SYSERR ==
-          (tolerant = GNUNET_CONFIGURATION_get_value_yesno(sh->cfg,
-                                                           sh->service_name,
-                                                           "TOLERANT")))
-        {
-          LOG(GNUNET_ERROR_TYPE_ERROR,
-              _("Specified value for `%s' of service `%s' is invalid\n"),
-              "TOLERANT",
-              sh->service_name);
-          return GNUNET_SYSERR;
-        }
+      LOG (GNUNET_ERROR_TYPE_ERROR,
+           _ ("Specified value for `%s' of service `%s' is invalid\n"),
+           "TOLERANT",
+           sh->service_name);
+      return GNUNET_SYSERR;
     }
+  }
   else
     tolerant = GNUNET_NO;
 
   lsocks = NULL;
 
   errno = 0;
-  if ((NULL != (nfds = getenv("LISTEN_FDS"))) &&
-      (1 == sscanf(nfds, "%u%1s", &cnt, dummy)) && (cnt > 0) &&
+  if ((NULL != (nfds = getenv ("LISTEN_FDS"))) &&
+      (1 == sscanf (nfds, "%u%1s", &cnt, dummy)) && (cnt > 0) &&
       (cnt < FD_SETSIZE) && (cnt + 4 < FD_SETSIZE))
+  {
+    lsocks = GNUNET_new_array (cnt + 1, struct GNUNET_NETWORK_Handle *);
+    while (0 < cnt--)
     {
-      lsocks = GNUNET_new_array(cnt + 1, struct GNUNET_NETWORK_Handle *);
-      while (0 < cnt--)
-        {
-          flags = fcntl(3 + cnt, F_GETFD);
-          if ((flags < 0) || (0 != (flags & FD_CLOEXEC)) ||
-              (NULL == (lsocks[cnt] = GNUNET_NETWORK_socket_box_native(3 + 
cnt))))
-            {
-              LOG(GNUNET_ERROR_TYPE_ERROR,
-                  _(
-                    "Could not access pre-bound socket %u, will try to bind 
myself\n"),
-                  (unsigned int)3 + cnt);
-              cnt++;
-              while (NULL != lsocks[cnt])
-                GNUNET_break(GNUNET_OK ==
-                             GNUNET_NETWORK_socket_close(lsocks[cnt++]));
-              GNUNET_free(lsocks);
-              lsocks = NULL;
-              break;
-            }
-        }
-      unsetenv("LISTEN_FDS");
+      flags = fcntl (3 + cnt, F_GETFD);
+      if ((flags < 0) || (0 != (flags & FD_CLOEXEC)) ||
+          (NULL == (lsocks[cnt] = GNUNET_NETWORK_socket_box_native (3 + cnt))))
+      {
+        LOG (GNUNET_ERROR_TYPE_ERROR,
+             _ (
+               "Could not access pre-bound socket %u, will try to bind 
myself\n"),
+             (unsigned int) 3 + cnt);
+        cnt++;
+        while (NULL != lsocks[cnt])
+          GNUNET_break (GNUNET_OK ==
+                        GNUNET_NETWORK_socket_close (lsocks[cnt++]));
+        GNUNET_free (lsocks);
+        lsocks = NULL;
+        break;
+      }
     }
+    unsetenv ("LISTEN_FDS");
+  }
 
   if (NULL != lsocks)
+  {
+    /* listen only on inherited sockets if we have any */
+    struct GNUNET_NETWORK_Handle **ls;
+
+    for (ls = lsocks; NULL != *ls; ls++)
     {
-      /* listen only on inherited sockets if we have any */
-      struct GNUNET_NETWORK_Handle **ls;
-
-      for (ls = lsocks; NULL != *ls; ls++)
-        {
-          struct ServiceListenContext *slc;
-
-          slc = GNUNET_new(struct ServiceListenContext);
-          slc->sh = sh;
-          slc->listen_socket = *ls;
-          GNUNET_CONTAINER_DLL_insert(sh->slc_head, sh->slc_tail, slc);
-        }
-      GNUNET_free(lsocks);
+      struct ServiceListenContext *slc;
+
+      slc = GNUNET_new (struct ServiceListenContext);
+      slc->sh = sh;
+      slc->listen_socket = *ls;
+      GNUNET_CONTAINER_DLL_insert (sh->slc_head, sh->slc_tail, slc);
     }
+    GNUNET_free (lsocks);
+  }
   else
-    {
-      struct sockaddr **addrs;
-      socklen_t *addrlens;
-      int num;
+  {
+    struct sockaddr **addrs;
+    socklen_t *addrlens;
+    int num;
 
-      num = get_server_addresses(sh->service_name, sh->cfg, &addrs, &addrlens);
-      if (GNUNET_SYSERR == num)
-        return GNUNET_SYSERR;
+    num = get_server_addresses (sh->service_name, sh->cfg, &addrs, &addrlens);
+    if (GNUNET_SYSERR == num)
+      return GNUNET_SYSERR;
+
+    for (int i = 0; i < num; i++)
+    {
+      struct ServiceListenContext *slc;
 
-      for (int i = 0; i < num; i++)
-        {
-          struct ServiceListenContext *slc;
-
-          slc = GNUNET_new(struct ServiceListenContext);
-          slc->sh = sh;
-          slc->listen_socket = open_listen_socket(addrs[i], addrlens[i]);
-          GNUNET_free(addrs[i]);
-          if (NULL == slc->listen_socket)
-            {
-              GNUNET_log_strerror(GNUNET_ERROR_TYPE_ERROR, "bind");
-              GNUNET_free(slc);
-              continue;
-            }
-          GNUNET_CONTAINER_DLL_insert(sh->slc_head, sh->slc_tail, slc);
-        }
-      GNUNET_free_non_null(addrlens);
-      GNUNET_free_non_null(addrs);
-      if ((0 != num) && (NULL == sh->slc_head))
-        {
-          /* All attempts to bind failed, hard failure */
-          GNUNET_log(
-            GNUNET_ERROR_TYPE_ERROR,
-            _(
-              "Could not bind to any of the ports I was supposed to, refusing 
to run!\n"));
-          return GNUNET_SYSERR;
-        }
+      slc = GNUNET_new (struct ServiceListenContext);
+      slc->sh = sh;
+      slc->listen_socket = open_listen_socket (addrs[i], addrlens[i]);
+      GNUNET_free (addrs[i]);
+      if (NULL == slc->listen_socket)
+      {
+        GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "bind");
+        GNUNET_free (slc);
+        continue;
+      }
+      GNUNET_CONTAINER_DLL_insert (sh->slc_head, sh->slc_tail, slc);
     }
+    GNUNET_free_non_null (addrlens);
+    GNUNET_free_non_null (addrs);
+    if ((0 != num) && (NULL == sh->slc_head))
+    {
+      /* All attempts to bind failed, hard failure */
+      GNUNET_log (
+        GNUNET_ERROR_TYPE_ERROR,
+        _ (
+          "Could not bind to any of the ports I was supposed to, refusing to 
run!\n"));
+      return GNUNET_SYSERR;
+    }
+  }
 
   sh->require_found = tolerant ? GNUNET_NO : GNUNET_YES;
-  sh->match_uid = GNUNET_CONFIGURATION_get_value_yesno(sh->cfg,
-                                                       sh->service_name,
-                                                       "UNIX_MATCH_UID");
-  sh->match_gid = GNUNET_CONFIGURATION_get_value_yesno(sh->cfg,
-                                                       sh->service_name,
-                                                       "UNIX_MATCH_GID");
-  process_acl4(&sh->v4_denied, sh, "REJECT_FROM");
-  process_acl4(&sh->v4_allowed, sh, "ACCEPT_FROM");
-  process_acl6(&sh->v6_denied, sh, "REJECT_FROM6");
-  process_acl6(&sh->v6_allowed, sh, "ACCEPT_FROM6");
+  sh->match_uid = GNUNET_CONFIGURATION_get_value_yesno (sh->cfg,
+                                                        sh->service_name,
+                                                        "UNIX_MATCH_UID");
+  sh->match_gid = GNUNET_CONFIGURATION_get_value_yesno (sh->cfg,
+                                                        sh->service_name,
+                                                        "UNIX_MATCH_GID");
+  process_acl4 (&sh->v4_denied, sh, "REJECT_FROM");
+  process_acl4 (&sh->v4_allowed, sh, "ACCEPT_FROM");
+  process_acl6 (&sh->v6_denied, sh, "REJECT_FROM6");
+  process_acl6 (&sh->v6_allowed, sh, "ACCEPT_FROM6");
   return GNUNET_OK;
 }
 
@@ -1600,14 +1594,14 @@ setup_service(struct GNUNET_SERVICE_Handle *sh)
  * @return value of the 'USERNAME' option
  */
 static char *
-get_user_name(struct GNUNET_SERVICE_Handle *sh)
+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;
 }
@@ -1620,45 +1614,45 @@ get_user_name(struct GNUNET_SERVICE_Handle *sh)
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 static int
-set_user_id(struct GNUNET_SERVICE_Handle *sh)
+set_user_id (struct GNUNET_SERVICE_Handle *sh)
 {
   char *user;
 
-  if (NULL == (user = get_user_name(sh)))
+  if (NULL == (user = get_user_name (sh)))
     return GNUNET_OK; /* keep */
 
   struct passwd *pws;
 
   errno = 0;
-  pws = getpwnam(user);
+  pws = getpwnam (user);
   if (NULL == pws)
-    {
-      LOG(GNUNET_ERROR_TYPE_ERROR,
-          _("Cannot obtain information about user `%s': %s\n"),
-          user,
-          errno == 0 ? _("No such user") : strerror(errno));
-      GNUNET_free(user);
-      return GNUNET_SYSERR;
-    }
-  if ((0 != setgid(pws->pw_gid)) || (0 != setegid(pws->pw_gid)) ||
+  {
+    LOG (GNUNET_ERROR_TYPE_ERROR,
+         _ ("Cannot obtain information about user `%s': %s\n"),
+         user,
+         errno == 0 ? _ ("No such user") : strerror (errno));
+    GNUNET_free (user);
+    return GNUNET_SYSERR;
+  }
+  if ((0 != setgid (pws->pw_gid)) || (0 != setegid (pws->pw_gid)) ||
 #if HAVE_INITGROUPS
-      (0 != initgroups(user, pws->pw_gid)) ||
+      (0 != initgroups (user, pws->pw_gid)) ||
 #endif
-      (0 != setuid(pws->pw_uid)) || (0 != seteuid(pws->pw_uid)))
+      (0 != setuid (pws->pw_uid)) || (0 != seteuid (pws->pw_uid)))
+  {
+    if ((0 != setregid (pws->pw_gid, pws->pw_gid)) ||
+        (0 != setreuid (pws->pw_uid, pws->pw_uid)))
     {
-      if ((0 != setregid(pws->pw_gid, pws->pw_gid)) ||
-          (0 != setreuid(pws->pw_uid, pws->pw_uid)))
-        {
-          LOG(GNUNET_ERROR_TYPE_ERROR,
-              _("Cannot change user/group to `%s': %s\n"),
-              user,
-              strerror(errno));
-          GNUNET_free(user);
-          return GNUNET_SYSERR;
-        }
+      LOG (GNUNET_ERROR_TYPE_ERROR,
+           _ ("Cannot change user/group to `%s': %s\n"),
+           user,
+           strerror (errno));
+      GNUNET_free (user);
+      return GNUNET_SYSERR;
     }
+  }
 
-  GNUNET_free(user);
+  GNUNET_free (user);
   return GNUNET_OK;
 }
 
@@ -1671,14 +1665,14 @@ set_user_id(struct GNUNET_SERVICE_Handle *sh)
  * @return name of the file for the process ID
  */
 static char *
-get_pid_file_name(struct GNUNET_SERVICE_Handle *sh)
+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;
 }
@@ -1690,15 +1684,15 @@ get_pid_file_name(struct GNUNET_SERVICE_Handle *sh)
  * @param sh service context
  */
 static void
-pid_file_delete(struct GNUNET_SERVICE_Handle *sh)
+pid_file_delete (struct GNUNET_SERVICE_Handle *sh)
 {
-  char *pif = get_pid_file_name(sh);
+  char *pif = get_pid_file_name (sh);
 
   if (NULL == pif)
     return; /* no PID file */
-  if (0 != unlink(pif))
-    LOG_STRERROR_FILE(GNUNET_ERROR_TYPE_WARNING, "unlink", pif);
-  GNUNET_free(pif);
+  if (0 != unlink (pif))
+    LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "unlink", pif);
+  GNUNET_free (pif);
 }
 
 
@@ -1709,73 +1703,73 @@ pid_file_delete(struct GNUNET_SERVICE_Handle *sh)
  * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
  */
 static int
-detach_terminal(struct GNUNET_SERVICE_Handle *sh)
+detach_terminal (struct GNUNET_SERVICE_Handle *sh)
 {
   pid_t pid;
   int nullfd;
   int filedes[2];
 
-  if (0 != pipe(filedes))
-    {
-      LOG_STRERROR(GNUNET_ERROR_TYPE_ERROR, "pipe");
-      return GNUNET_SYSERR;
-    }
-  pid = fork();
+  if (0 != pipe (filedes))
+  {
+    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "pipe");
+    return GNUNET_SYSERR;
+  }
+  pid = fork ();
   if (pid < 0)
-    {
-      LOG_STRERROR(GNUNET_ERROR_TYPE_ERROR, "fork");
-      return GNUNET_SYSERR;
-    }
+  {
+    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "fork");
+    return GNUNET_SYSERR;
+  }
   if (0 != pid)
+  {
+    /* Parent */
+    char c;
+
+    GNUNET_break (0 == close (filedes[1]));
+    c = 'X';
+    if (1 != read (filedes[0], &c, sizeof(char)))
+      LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "read");
+    fflush (stdout);
+    switch (c)
     {
-      /* Parent */
-      char c;
-
-      GNUNET_break(0 == close(filedes[1]));
-      c = 'X';
-      if (1 != read(filedes[0], &c, sizeof(char)))
-        LOG_STRERROR(GNUNET_ERROR_TYPE_WARNING, "read");
-      fflush(stdout);
-      switch (c)
-        {
-        case '.':
-          exit(0);
-
-        case 'I':
-          LOG(GNUNET_ERROR_TYPE_INFO,
-              _("Service process failed to initialize\n"));
-          break;
-
-        case 'S':
-          LOG(GNUNET_ERROR_TYPE_INFO,
-              _("Service process could not initialize server function\n"));
-          break;
-
-        case 'X':
-          LOG(GNUNET_ERROR_TYPE_INFO,
-              _("Service process failed to report status\n"));
-          break;
-        }
-      exit(1); /* child reported error */
+    case '.':
+      exit (0);
+
+    case 'I':
+      LOG (GNUNET_ERROR_TYPE_INFO,
+           _ ("Service process failed to initialize\n"));
+      break;
+
+    case 'S':
+      LOG (GNUNET_ERROR_TYPE_INFO,
+           _ ("Service process could not initialize server function\n"));
+      break;
+
+    case 'X':
+      LOG (GNUNET_ERROR_TYPE_INFO,
+           _ ("Service process failed to report status\n"));
+      break;
     }
-  GNUNET_break(0 == close(0));
-  GNUNET_break(0 == close(1));
-  GNUNET_break(0 == close(filedes[0]));
-  nullfd = open("/dev/null", O_RDWR | O_APPEND);
+    exit (1);  /* child reported error */
+  }
+  GNUNET_break (0 == close (0));
+  GNUNET_break (0 == close (1));
+  GNUNET_break (0 == close (filedes[0]));
+  nullfd = open ("/dev/null", O_RDWR | O_APPEND);
   if (nullfd < 0)
     return GNUNET_SYSERR;
   /* set stdin/stdout to /dev/null */
-  if ((dup2(nullfd, 0) < 0) || (dup2(nullfd, 1) < 0))
-    {
-      LOG_STRERROR(GNUNET_ERROR_TYPE_ERROR, "dup2");
-      (void)close(nullfd);
-      return GNUNET_SYSERR;
-    }
-  (void)close(nullfd);
+  if ((dup2 (nullfd, 0) < 0) || (dup2 (nullfd, 1) < 0))
+  {
+    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "dup2");
+    (void) close (nullfd);
+    return GNUNET_SYSERR;
+  }
+  (void) close (nullfd);
   /* Detach from controlling terminal */
-  pid = setsid();
+  pid = setsid ();
   if (-1 == pid)
-    LOG_STRERROR(GNUNET_ERROR_TYPE_ERROR, "setsid");
+    LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "setsid");
   sh->ready_confirm_fd = filedes[1];
 
   return GNUNET_OK;
@@ -1789,23 +1783,23 @@ detach_terminal(struct GNUNET_SERVICE_Handle *sh)
  * @param sh handle to the service to tear down.
  */
 static void
-teardown_service(struct GNUNET_SERVICE_Handle *sh)
+teardown_service (struct GNUNET_SERVICE_Handle *sh)
 {
   struct ServiceListenContext *slc;
 
-  GNUNET_free_non_null(sh->v4_denied);
-  GNUNET_free_non_null(sh->v6_denied);
-  GNUNET_free_non_null(sh->v4_allowed);
-  GNUNET_free_non_null(sh->v6_allowed);
+  GNUNET_free_non_null (sh->v4_denied);
+  GNUNET_free_non_null (sh->v6_denied);
+  GNUNET_free_non_null (sh->v4_allowed);
+  GNUNET_free_non_null (sh->v6_allowed);
   while (NULL != (slc = sh->slc_head))
-    {
-      GNUNET_CONTAINER_DLL_remove(sh->slc_head, sh->slc_tail, slc);
-      if (NULL != slc->listen_task)
-        GNUNET_SCHEDULER_cancel(slc->listen_task);
-      GNUNET_break(GNUNET_OK ==
-                   GNUNET_NETWORK_socket_close(slc->listen_socket));
-      GNUNET_free(slc);
-    }
+  {
+    GNUNET_CONTAINER_DLL_remove (sh->slc_head, sh->slc_tail, slc);
+    if (NULL != slc->listen_task)
+      GNUNET_SCHEDULER_cancel (slc->listen_task);
+    GNUNET_break (GNUNET_OK ==
+                  GNUNET_NETWORK_socket_close (slc->listen_socket));
+    GNUNET_free (slc);
+  }
 }
 
 
@@ -1816,7 +1810,7 @@ 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;
@@ -1824,13 +1818,13 @@ return_agpl(void *cls, const struct 
GNUNET_MessageHeader *msg)
   struct GNUNET_MessageHeader *res;
   size_t slen;
 
-  (void)msg;
-  slen = strlen(GNUNET_AGPL_URL) + 1;
-  env = GNUNET_MQ_msg_extra(res, GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, slen);
-  memcpy(&res[1], GNUNET_AGPL_URL, slen);
-  mq = GNUNET_SERVICE_client_get_mq(client);
-  GNUNET_MQ_send(mq, env);
-  GNUNET_SERVICE_client_continue(client);
+  (void) msg;
+  slen = strlen (GNUNET_AGPL_URL) + 1;
+  env = GNUNET_MQ_msg_extra (res, GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, slen);
+  memcpy (&res[1], GNUNET_AGPL_URL, slen);
+  mq = GNUNET_SERVICE_client_get_mq (client);
+  GNUNET_MQ_send (mq, env);
+  GNUNET_SERVICE_client_continue (client);
 }
 
 
@@ -1871,29 +1865,29 @@ return_agpl(void *cls, const struct 
GNUNET_MessageHeader *msg)
  * @return NULL on error
  */
 struct GNUNET_SERVICE_Handle *
-GNUNET_SERVICE_start(const char *service_name,
-                     const struct GNUNET_CONFIGURATION_Handle *cfg,
-                     GNUNET_SERVICE_ConnectHandler connect_cb,
-                     GNUNET_SERVICE_DisconnectHandler disconnect_cb,
-                     void *cls,
-                     const struct GNUNET_MQ_MessageHandler *handlers)
+GNUNET_SERVICE_start (const char *service_name,
+                      const struct GNUNET_CONFIGURATION_Handle *cfg,
+                      GNUNET_SERVICE_ConnectHandler connect_cb,
+                      GNUNET_SERVICE_DisconnectHandler disconnect_cb,
+                      void *cls,
+                      const struct GNUNET_MQ_MessageHandler *handlers)
 {
   struct GNUNET_SERVICE_Handle *sh;
 
-  sh = GNUNET_new(struct GNUNET_SERVICE_Handle);
+  sh = GNUNET_new (struct GNUNET_SERVICE_Handle);
   sh->service_name = service_name;
   sh->cfg = cfg;
   sh->connect_cb = connect_cb;
   sh->disconnect_cb = disconnect_cb;
   sh->cb_cls = cls;
-  sh->handlers = GNUNET_MQ_copy_handlers2(handlers, &return_agpl, NULL);
-  if (GNUNET_OK != setup_service(sh))
-    {
-      GNUNET_free_non_null(sh->handlers);
-      GNUNET_free(sh);
-      return NULL;
-    }
-  do_resume(sh, SUSPEND_STATE_NONE);
+  sh->handlers = GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL);
+  if (GNUNET_OK != setup_service (sh))
+  {
+    GNUNET_free_non_null (sh->handlers);
+    GNUNET_free (sh);
+    return NULL;
+  }
+  do_resume (sh, SUSPEND_STATE_NONE);
   return sh;
 }
 
@@ -1904,16 +1898,16 @@ GNUNET_SERVICE_start(const char *service_name,
  * @param srv service to stop
  */
 void
-GNUNET_SERVICE_stop(struct GNUNET_SERVICE_Handle *srv)
+GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv)
 {
   struct GNUNET_SERVICE_Client *client;
 
-  GNUNET_SERVICE_suspend(srv);
+  GNUNET_SERVICE_suspend (srv);
   while (NULL != (client = srv->clients_head))
-    GNUNET_SERVICE_client_drop(client);
-  teardown_service(srv);
-  GNUNET_free_non_null(srv->handlers);
-  GNUNET_free(srv);
+    GNUNET_SERVICE_client_drop (client);
+  teardown_service (srv);
+  GNUNET_free_non_null (srv->handlers);
+  GNUNET_free (srv);
 }
 
 
@@ -1959,15 +1953,15 @@ GNUNET_SERVICE_stop(struct GNUNET_SERVICE_Handle *srv)
  * @return 0 on success, non-zero on error
  */
 int
-GNUNET_SERVICE_run_(int argc,
-                    char *const *argv,
-                    const char *service_name,
-                    enum GNUNET_SERVICE_Options options,
-                    GNUNET_SERVICE_InitCallback service_init_cb,
-                    GNUNET_SERVICE_ConnectHandler connect_cb,
-                    GNUNET_SERVICE_DisconnectHandler disconnect_cb,
-                    void *cls,
-                    const struct GNUNET_MQ_MessageHandler *handlers)
+GNUNET_SERVICE_run_ (int argc,
+                     char *const *argv,
+                     const char *service_name,
+                     enum GNUNET_SERVICE_Options options,
+                     GNUNET_SERVICE_InitCallback service_init_cb,
+                     GNUNET_SERVICE_ConnectHandler connect_cb,
+                     GNUNET_SERVICE_DisconnectHandler disconnect_cb,
+                     void *cls,
+                     const struct GNUNET_MQ_MessageHandler *handlers)
 {
   struct GNUNET_SERVICE_Handle sh;
 
@@ -1986,40 +1980,40 @@ GNUNET_SERVICE_run_(int argc,
   struct GNUNET_CONFIGURATION_Handle *cfg;
   int ret;
   int err;
-  const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get();
+  const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
 
   struct GNUNET_GETOPT_CommandLineOption service_options[] =
-  { GNUNET_GETOPT_option_cfgfile(&opt_cfg_filename),
-    GNUNET_GETOPT_option_flag('d',
-                              "daemonize",
-                              gettext_noop(
-                                "do daemonize (detach from terminal)"),
-                              &do_daemonize),
-    GNUNET_GETOPT_option_help(NULL),
-    GNUNET_GETOPT_option_loglevel(&loglev),
-    GNUNET_GETOPT_option_logfile(&logfile),
-    GNUNET_GETOPT_option_version(pd->version),
+  { GNUNET_GETOPT_option_cfgfile (&opt_cfg_filename),
+    GNUNET_GETOPT_option_flag ('d',
+                               "daemonize",
+                               gettext_noop (
+                                 "do daemonize (detach from terminal)"),
+                               &do_daemonize),
+    GNUNET_GETOPT_option_help (NULL),
+    GNUNET_GETOPT_option_loglevel (&loglev),
+    GNUNET_GETOPT_option_logfile (&logfile),
+    GNUNET_GETOPT_option_version (pd->version),
     GNUNET_GETOPT_OPTION_END };
 
   err = 1;
-  memset(&sh, 0, sizeof(sh));
-  xdg = getenv("XDG_CONFIG_HOME");
+  memset (&sh, 0, sizeof(sh));
+  xdg = getenv ("XDG_CONFIG_HOME");
   if (NULL != xdg)
-    GNUNET_asprintf(&cfg_filename,
-                    "%s%s%s",
-                    xdg,
-                    DIR_SEPARATOR_STR,
-                    pd->config_file);
+    GNUNET_asprintf (&cfg_filename,
+                     "%s%s%s",
+                     xdg,
+                     DIR_SEPARATOR_STR,
+                     pd->config_file);
   else
-    cfg_filename = GNUNET_strdup(pd->user_config_file);
+    cfg_filename = GNUNET_strdup (pd->user_config_file);
   sh.ready_confirm_fd = -1;
   sh.options = options;
-  sh.cfg = cfg = GNUNET_CONFIGURATION_create();
+  sh.cfg = cfg = GNUNET_CONFIGURATION_create ();
   sh.service_init_cb = service_init_cb;
   sh.connect_cb = connect_cb;
   sh.disconnect_cb = disconnect_cb;
   sh.cb_cls = cls;
-  sh.handlers = GNUNET_MQ_copy_handlers(handlers);
+  sh.handlers = GNUNET_MQ_copy_handlers (handlers);
   sh.service_name = service_name;
   sh.ret = 0;
   /* setup subsystems */
@@ -2029,135 +2023,135 @@ GNUNET_SERVICE_run_(int argc,
   do_daemonize = 0;
 #if ENABLE_NLS
   if (NULL != pd->gettext_domain)
+  {
+    setlocale (LC_ALL, "");
+    path = (NULL == pd->gettext_path) ?
+           GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR) :
+           GNUNET_strdup (pd->gettext_path);
+    if (NULL != path)
     {
-      setlocale(LC_ALL, "");
-      path = (NULL == pd->gettext_path) ?
-             GNUNET_OS_installation_get_path(GNUNET_OS_IPK_LOCALEDIR) :
-             GNUNET_strdup(pd->gettext_path);
-      if (NULL != path)
-        {
-          bindtextdomain(pd->gettext_domain, path);
-          GNUNET_free(path);
-        }
-      textdomain(pd->gettext_domain);
+      bindtextdomain (pd->gettext_domain, path);
+      GNUNET_free (path);
     }
+    textdomain (pd->gettext_domain);
+  }
 #endif
-  ret = GNUNET_GETOPT_run(service_name, service_options, argc, argv);
+  ret = GNUNET_GETOPT_run (service_name, service_options, argc, argv);
   if (GNUNET_SYSERR == ret)
     goto shutdown;
   if (GNUNET_NO == ret)
-    {
-      err = 0;
-      goto shutdown;
-    }
-  if (GNUNET_OK != GNUNET_log_setup(service_name, loglev, logfile))
-    {
-      GNUNET_break(0);
-      goto shutdown;
-    }
+  {
+    err = 0;
+    goto shutdown;
+  }
+  if (GNUNET_OK != GNUNET_log_setup (service_name, loglev, logfile))
+  {
+    GNUNET_break (0);
+    goto shutdown;
+  }
   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"),
-                     opt_cfg_filename);
-          goto shutdown;
-        }
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  _ ("Malformed configuration file `%s', exit ...\n"),
+                  opt_cfg_filename);
+      goto shutdown;
     }
+  }
   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))
-            {
-              GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
-                         _("Malformed configuration file `%s', exit ...\n"),
-                         cfg_filename);
-              goto shutdown;
-            }
-        }
-      else
-        {
-          if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load(cfg, NULL))
-            {
-              GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
-                         _("Malformed configuration, exit ...\n"));
-              goto shutdown;
-            }
-        }
+      if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cfg_filename))
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    _ ("Malformed configuration file `%s', exit ...\n"),
+                    cfg_filename);
+        goto shutdown;
+      }
     }
-  if (GNUNET_OK != setup_service(&sh))
-    goto shutdown;
-  if ((1 == do_daemonize) && (GNUNET_OK != detach_terminal(&sh)))
+    else
     {
-      GNUNET_break(0);
-      goto shutdown;
+      if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, NULL))
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                    _ ("Malformed configuration, exit ...\n"));
+        goto shutdown;
+      }
     }
-  if (GNUNET_OK != set_user_id(&sh))
+  }
+  if (GNUNET_OK != setup_service (&sh))
     goto shutdown;
-  LOG(GNUNET_ERROR_TYPE_DEBUG,
-      "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)))
-    {
-      clock_offset = skew_offset - skew_variance;
-      GNUNET_TIME_set_offset(clock_offset);
-      LOG(GNUNET_ERROR_TYPE_DEBUG, "Skewing clock by %dll ms\n", clock_offset);
-    }
-  GNUNET_RESOLVER_connect(sh.cfg);
+  if ((1 == do_daemonize) && (GNUNET_OK != detach_terminal (&sh)))
+  {
+    GNUNET_break (0);
+    goto shutdown;
+  }
+  if (GNUNET_OK != set_user_id (&sh))
+    goto shutdown;
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "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)))
+  {
+    clock_offset = skew_offset - skew_variance;
+    GNUNET_TIME_set_offset (clock_offset);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "Skewing clock by %dll ms\n", clock_offset);
+  }
+  GNUNET_RESOLVER_connect (sh.cfg);
 
   /* actually run service */
   err = 0;
-  GNUNET_SCHEDULER_run(&service_main, &sh);
+  GNUNET_SCHEDULER_run (&service_main, &sh);
   /* shutdown */
   if (1 == do_daemonize)
-    pid_file_delete(&sh);
+    pid_file_delete (&sh);
 
 shutdown:
   if (-1 != sh.ready_confirm_fd)
-    {
-      if (1 != write(sh.ready_confirm_fd, err ? "I" : "S", 1))
-        LOG_STRERROR(GNUNET_ERROR_TYPE_WARNING, "write");
-      GNUNET_break(0 == close(sh.ready_confirm_fd));
-    }
+  {
+    if (1 != write (sh.ready_confirm_fd, err ? "I" : "S", 1))
+      LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "write");
+    GNUNET_break (0 == close (sh.ready_confirm_fd));
+  }
 #if HAVE_MALLINFO
   {
     char *counter;
 
-    if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value(sh.cfg,
-                                                       service_name,
-                                                       "GAUGER_HEAP")) &&
-        (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string(sh.cfg,
-                                                            service_name,
-                                                            "GAUGER_HEAP",
-                                                            &counter)))
-      {
-        struct mallinfo mi;
+    if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (sh.cfg,
+                                                        service_name,
+                                                        "GAUGER_HEAP")) &&
+        (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (sh.cfg,
+                                                             service_name,
+                                                             "GAUGER_HEAP",
+                                                             &counter)))
+    {
+      struct mallinfo mi;
 
-        mi = mallinfo();
-        GAUGER(service_name, counter, mi.usmblks, "blocks");
-        GNUNET_free(counter);
-      }
+      mi = mallinfo ();
+      GAUGER (service_name, counter, mi.usmblks, "blocks");
+      GNUNET_free (counter);
+    }
   }
 #endif
-  teardown_service(&sh);
-  GNUNET_free_non_null(sh.handlers);
-  GNUNET_SPEEDUP_stop_();
-  GNUNET_CONFIGURATION_destroy(cfg);
-  GNUNET_free_non_null(logfile);
-  GNUNET_free_non_null(loglev);
-  GNUNET_free(cfg_filename);
-  GNUNET_free_non_null(opt_cfg_filename);
+  teardown_service (&sh);
+  GNUNET_free_non_null (sh.handlers);
+  GNUNET_SPEEDUP_stop_ ();
+  GNUNET_CONFIGURATION_destroy (cfg);
+  GNUNET_free_non_null (logfile);
+  GNUNET_free_non_null (loglev);
+  GNUNET_free (cfg_filename);
+  GNUNET_free_non_null (opt_cfg_filename);
 
   return err ? GNUNET_SYSERR : sh.ret;
 }
@@ -2170,9 +2164,9 @@ shutdown:
  * @param sh service to stop accepting connections.
  */
 void
-GNUNET_SERVICE_suspend(struct GNUNET_SERVICE_Handle *sh)
+GNUNET_SERVICE_suspend (struct GNUNET_SERVICE_Handle *sh)
 {
-  do_suspend(sh, SUSPEND_STATE_APP);
+  do_suspend (sh, SUSPEND_STATE_APP);
 }
 
 
@@ -2182,9 +2176,9 @@ GNUNET_SERVICE_suspend(struct GNUNET_SERVICE_Handle *sh)
  * @param sh service to resume accepting connections.
  */
 void
-GNUNET_SERVICE_resume(struct GNUNET_SERVICE_Handle *sh)
+GNUNET_SERVICE_resume (struct GNUNET_SERVICE_Handle *sh)
 {
-  do_resume(sh, SUSPEND_STATE_APP);
+  do_resume (sh, SUSPEND_STATE_APP);
 }
 
 
@@ -2195,32 +2189,32 @@ GNUNET_SERVICE_resume(struct GNUNET_SERVICE_Handle *sh)
  * @param cls our `struct GNUNET_SERVICE_Client`
  */
 static void
-resume_client_receive(void *cls)
+resume_client_receive (void *cls)
 {
   struct GNUNET_SERVICE_Client *c = cls;
   int ret;
 
   c->recv_task = NULL;
   /* first, check if there is still something in the buffer */
-  ret = GNUNET_MST_next(c->mst, GNUNET_YES);
+  ret = GNUNET_MST_next (c->mst, GNUNET_YES);
   if (GNUNET_SYSERR == ret)
-    {
-      if (NULL == c->drop_task)
-        GNUNET_SERVICE_client_drop(c);
-      return;
-    }
+  {
+    if (NULL == c->drop_task)
+      GNUNET_SERVICE_client_drop (c);
+    return;
+  }
   if (GNUNET_NO == ret)
     return; /* done processing, wait for more later */
-  GNUNET_assert(GNUNET_OK == ret);
+  GNUNET_assert (GNUNET_OK == ret);
   if (GNUNET_YES == c->needs_continue)
     return; /* #GNUNET_MST_next() did give a message to the client */
   /* need to receive more data from the network first */
   if (NULL != c->recv_task)
     return;
-  c->recv_task = GNUNET_SCHEDULER_add_read_net(GNUNET_TIME_UNIT_FOREVER_REL,
-                                               c->sock,
-                                               &service_client_recv,
-                                               c);
+  c->recv_task = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                                c->sock,
+                                                &service_client_recv,
+                                                c);
 }
 
 
@@ -2231,18 +2225,18 @@ resume_client_receive(void *cls)
  * @param c the client to continue receiving from
  */
 void
-GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
+GNUNET_SERVICE_client_continue (struct GNUNET_SERVICE_Client *c)
 {
-  GNUNET_assert(NULL == c->drop_task);
-  GNUNET_assert(GNUNET_YES == c->needs_continue);
-  GNUNET_assert(NULL == c->recv_task);
+  GNUNET_assert (NULL == c->drop_task);
+  GNUNET_assert (GNUNET_YES == c->needs_continue);
+  GNUNET_assert (NULL == c->recv_task);
   c->needs_continue = GNUNET_NO;
   if (NULL != c->warn_task)
-    {
-      GNUNET_SCHEDULER_cancel(c->warn_task);
-      c->warn_task = NULL;
-    }
-  c->recv_task = GNUNET_SCHEDULER_add_now(&resume_client_receive, c);
+  {
+    GNUNET_SCHEDULER_cancel (c->warn_task);
+    c->warn_task = NULL;
+  }
+  c->recv_task = GNUNET_SCHEDULER_add_now (&resume_client_receive, c);
 }
 
 
@@ -2255,14 +2249,14 @@ GNUNET_SERVICE_client_continue(struct 
GNUNET_SERVICE_Client *c)
  * @param c client for which to disable the warning
  */
 void
-GNUNET_SERVICE_client_disable_continue_warning(struct GNUNET_SERVICE_Client *c)
+GNUNET_SERVICE_client_disable_continue_warning (struct GNUNET_SERVICE_Client 
*c)
 {
-  GNUNET_break(NULL != c->warn_task);
+  GNUNET_break (NULL != c->warn_task);
   if (NULL != c->warn_task)
-    {
-      GNUNET_SCHEDULER_cancel(c->warn_task);
-      c->warn_task = NULL;
-    }
+  {
+    GNUNET_SCHEDULER_cancel (c->warn_task);
+    c->warn_task = NULL;
+  }
 }
 
 
@@ -2272,32 +2266,32 @@ GNUNET_SERVICE_client_disable_continue_warning(struct 
GNUNET_SERVICE_Client *c)
  * @param cls the `struct GNUNET_SERVICE_Client`.
  */
 static void
-finish_client_drop(void *cls)
+finish_client_drop (void *cls)
 {
   struct GNUNET_SERVICE_Client *c = cls;
   struct GNUNET_SERVICE_Handle *sh = c->sh;
 
   c->drop_task = NULL;
-  GNUNET_assert(NULL == c->send_task);
-  GNUNET_assert(NULL == c->recv_task);
-  GNUNET_assert(NULL == c->warn_task);
-  GNUNET_MST_destroy(c->mst);
-  GNUNET_MQ_destroy(c->mq);
+  GNUNET_assert (NULL == c->send_task);
+  GNUNET_assert (NULL == c->recv_task);
+  GNUNET_assert (NULL == c->warn_task);
+  GNUNET_MST_destroy (c->mst);
+  GNUNET_MQ_destroy (c->mq);
   if (GNUNET_NO == c->persist)
-    {
-      GNUNET_break(GNUNET_OK == GNUNET_NETWORK_socket_close(c->sock));
-      if ((0 != (SUSPEND_STATE_EMFILE & sh->suspend_state)) &&
-          (0 == (SUSPEND_STATE_SHUTDOWN & sh->suspend_state)))
-        do_resume(sh, SUSPEND_STATE_EMFILE);
-    }
+  {
+    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (c->sock));
+    if ((0 != (SUSPEND_STATE_EMFILE & sh->suspend_state)) &&
+        (0 == (SUSPEND_STATE_SHUTDOWN & sh->suspend_state)))
+      do_resume (sh, SUSPEND_STATE_EMFILE);
+  }
   else
-    {
-      GNUNET_NETWORK_socket_free_memory_only_(c->sock);
-    }
-  GNUNET_free(c);
+  {
+    GNUNET_NETWORK_socket_free_memory_only_ (c->sock);
+  }
+  GNUNET_free (c);
   if ((0 != (SUSPEND_STATE_SHUTDOWN & sh->suspend_state)) &&
-      (GNUNET_NO == have_non_monitor_clients(sh)))
-    GNUNET_SERVICE_shutdown(sh);
+      (GNUNET_NO == have_non_monitor_clients (sh)))
+    GNUNET_SERVICE_shutdown (sh);
 }
 
 
@@ -2312,52 +2306,56 @@ finish_client_drop(void *cls)
  * @param c client to disconnect now
  */
 void
-GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
+GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c)
 {
   struct GNUNET_SERVICE_Handle *sh = c->sh;
 
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-             "Client dropped: %p (MQ: %p)\n",
-             c,
-             c->mq);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Client dropped: %p (MQ: %p)\n",
+              c,
+              c->mq);
 #if EXECINFO
   {
     void *backtrace_array[MAX_TRACE_DEPTH];
-    int num_backtrace_strings = backtrace(backtrace_array, MAX_TRACE_DEPTH);
+    int num_backtrace_strings = backtrace (backtrace_array, MAX_TRACE_DEPTH);
     char **backtrace_strings =
-      backtrace_symbols(backtrace_array, t->num_backtrace_strings);
+      backtrace_symbols (backtrace_array, t->num_backtrace_strings);
     for (unsigned int i = 0; i < num_backtrace_strings; i++)
-      LOG(GNUNET_ERROR_TYPE_DEBUG,
-          "client drop trace %u: %s\n",
-          i,
-          backtrace_strings[i]);
+      LOG (GNUNET_ERROR_TYPE_DEBUG,
+           "client drop trace %u: %s\n",
+           i,
+           backtrace_strings[i]);
   }
 #endif
   if (NULL != c->drop_task)
-    {
-      /* asked to drop twice! */
-      GNUNET_assert(0);
-      return;
-    }
-  GNUNET_CONTAINER_DLL_remove(sh->clients_head, sh->clients_tail, c);
+  {
+    /* asked to drop twice! */
+    GNUNET_assert (0);
+    return;
+  }
+  GNUNET_CONTAINER_DLL_remove (sh->clients_head,
+                               sh->clients_tail,
+                               c);
   if (NULL != sh->disconnect_cb)
-    sh->disconnect_cb(sh->cb_cls, c, c->user_context);
+    sh->disconnect_cb (sh->cb_cls,
+                       c,
+                       c->user_context);
   if (NULL != c->warn_task)
-    {
-      GNUNET_SCHEDULER_cancel(c->warn_task);
-      c->warn_task = NULL;
-    }
+  {
+    GNUNET_SCHEDULER_cancel (c->warn_task);
+    c->warn_task = NULL;
+  }
   if (NULL != c->recv_task)
-    {
-      GNUNET_SCHEDULER_cancel(c->recv_task);
-      c->recv_task = NULL;
-    }
+  {
+    GNUNET_SCHEDULER_cancel (c->recv_task);
+    c->recv_task = NULL;
+  }
   if (NULL != c->send_task)
-    {
-      GNUNET_SCHEDULER_cancel(c->send_task);
-      c->send_task = NULL;
-    }
-  c->drop_task = GNUNET_SCHEDULER_add_now(&finish_client_drop, c);
+  {
+    GNUNET_SCHEDULER_cancel (c->send_task);
+    c->send_task = NULL;
+  }
+  c->drop_task = GNUNET_SCHEDULER_add_now (&finish_client_drop, c);
 }
 
 
@@ -2367,14 +2365,14 @@ GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client 
*c)
  * @param sh server to shutdown
  */
 void
-GNUNET_SERVICE_shutdown(struct GNUNET_SERVICE_Handle *sh)
+GNUNET_SERVICE_shutdown (struct GNUNET_SERVICE_Handle *sh)
 {
   struct GNUNET_SERVICE_Client *client;
 
   if (0 == (sh->suspend_state & SUSPEND_STATE_SHUTDOWN))
-    do_suspend(sh, SUSPEND_STATE_SHUTDOWN);
+    do_suspend (sh, SUSPEND_STATE_SHUTDOWN);
   while (NULL != (client = sh->clients_head))
-    GNUNET_SERVICE_client_drop(client);
+    GNUNET_SERVICE_client_drop (client);
 }
 
 
@@ -2391,12 +2389,12 @@ GNUNET_SERVICE_shutdown(struct GNUNET_SERVICE_Handle 
*sh)
  * @param c client to mark as a monitor
  */
 void
-GNUNET_SERVICE_client_mark_monitor(struct GNUNET_SERVICE_Client *c)
+GNUNET_SERVICE_client_mark_monitor (struct GNUNET_SERVICE_Client *c)
 {
   c->is_monitor = GNUNET_YES;
   if (((0 != (SUSPEND_STATE_SHUTDOWN & c->sh->suspend_state)) &&
-       (GNUNET_NO == have_non_monitor_clients(c->sh))))
-    GNUNET_SERVICE_shutdown(c->sh);
+       (GNUNET_NO == have_non_monitor_clients (c->sh))))
+    GNUNET_SERVICE_shutdown (c->sh);
 }
 
 
@@ -2408,7 +2406,7 @@ GNUNET_SERVICE_client_mark_monitor(struct 
GNUNET_SERVICE_Client *c)
  * @param c client to persist the socket (never to be closed)
  */
 void
-GNUNET_SERVICE_client_persist(struct GNUNET_SERVICE_Client *c)
+GNUNET_SERVICE_client_persist (struct GNUNET_SERVICE_Client *c)
 {
   c->persist = GNUNET_YES;
 }
@@ -2421,10 +2419,10 @@ GNUNET_SERVICE_client_persist(struct 
GNUNET_SERVICE_Client *c)
  * @return the message queue of @a c
  */
 struct GNUNET_MQ_Handle *
-GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c)
+GNUNET_SERVICE_client_get_mq (struct GNUNET_SERVICE_Client *c)
 {
   return c->mq;
 }
 
 
-/* end of service_new.c */
+/* end of service.c */

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]