better error handling
authorChristian Grothoff <christian@grothoff.org>
Sun, 18 Sep 2011 08:15:49 +0000 (08:15 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 18 Sep 2011 08:15:49 +0000 (08:15 +0000)
src/util/service.c
src/util/test_service.c

index 9e15ae1ab92c427b1135f6993001e05b77717876..dc6a7330ed53d5fe553060185bfd48cd6b46630e 100644 (file)
@@ -1514,7 +1514,7 @@ GNUNET_SERVICE_run (int argc, char *const *argv, const char *serviceName,
                     enum GNUNET_SERVICE_Options opt, GNUNET_SERVICE_Main task,
                     void *task_cls)
 {
-#define HANDLE_ERROR do { err = 1; GNUNET_break (0); goto shutdown; } while (0)
+#define HANDLE_ERROR do { GNUNET_break (0); goto shutdown; } while (0)
 
   int err;
   char *cfg_fn;
@@ -1539,7 +1539,7 @@ GNUNET_SERVICE_run (int argc, char *const *argv, const char *serviceName,
     GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION),
     GNUNET_GETOPT_OPTION_END
   };
-  err = 0;
+  err = 1;
   do_daemonize = 0;
   logfile = NULL;
   loglev = GNUNET_strdup ("WARNING");
@@ -1587,6 +1587,7 @@ GNUNET_SERVICE_run (int argc, char *const *argv, const char *serviceName,
 #endif
   }
   /* actually run service */
+  err = 0;
   GNUNET_SCHEDULER_run (&service_task, &sctx);
 
   /* shutdown */
index 4d1608191ea827a90aad2e136caa70fd9c79471c..edfe3377111d58e244a344c2c6cf1c21a74924fd 100644 (file)
@@ -75,6 +75,7 @@ ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                                        &build_msg, client);
 }
 
+
 static void
 do_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
@@ -95,14 +96,13 @@ recv_cb (void *cls, struct GNUNET_SERVER_Client *client,
   ok = 0;
 }
 
+
 static struct GNUNET_SERVER_MessageHandler myhandlers[] = {
   {&recv_cb, NULL, MY_TYPE, sizeof (struct GNUNET_MessageHeader)},
   {NULL, NULL, 0, 0}
 };
 
 
-
-
 static void
 runner (void *cls, struct GNUNET_SERVER_Handle *server,
         const struct GNUNET_CONFIGURATION_Handle *cfg)