#include "gnunet_arm_service.h"
#include "gnunet_transport_service.h"
-#define VERBOSE GNUNET_NO
-
-#define START_ARM GNUNET_YES
-
/**
* How long until we give up on transmitting the message?
struct GNUNET_TRANSPORT_Handle *th;
struct GNUNET_MessageHeader *hello;
struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
-#if START_ARM
struct GNUNET_OS_Process *arm_proc;
-#endif
};
static struct PeerContext p1;
setup_peer (struct PeerContext *p, const char *cfgname)
{
p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
p->arm_proc =
GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
"-c", cfgname, NULL);
-#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->th =
GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, ¬ify_connect, NULL);
{
struct PeerContext *p = cls;
-#if START_ARM
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Killing ARM process.\n");
if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
GNUNET_OS_process_get_pid (p->arm_proc));
GNUNET_OS_process_destroy (p->arm_proc);
p->arm_proc = NULL;
-#endif
GNUNET_CONFIGURATION_destroy (p->cfg);
}
#include "gnunet_resolver_service.h"
#include "gnunet_statistics_service.h"
-#define START_ARM GNUNET_YES
-
#define MAX_URL_LEN 1000
/**
struct GNUNET_MessageHeader *hello;
struct GNUNET_CORE_Handle *core;
struct GNUNET_STATISTICS_Handle *stats;
-#if START_ARM
struct GNUNET_OS_Process *arm_proc;
-#endif
};
static int timeout;
GNUNET_CORE_disconnect (learn_peer.core);
learn_peer.core = NULL;
}
-#if START_ARM
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Killing hostlist server ARM process.\n");
if (0 != GNUNET_OS_process_kill (adv_peer.arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
GNUNET_OS_process_destroy (learn_peer.arm_proc);
learn_peer.arm_proc = NULL;
-#endif
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown complete....\n");
}
unsigned int result;
p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
p->arm_proc =
GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
"-c", cfgname, NULL);
-#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
if (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_string (p->cfg, "HOSTLIST", "HOSTLISTFILE",
setup_adv_peer (struct PeerContext *p, const char *cfgname)
{
p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
p->arm_proc =
GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
"-c", cfgname, NULL);
-#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
p->stats = GNUNET_STATISTICS_create ("hostlist", p->cfg);
GNUNET_assert (NULL != p->stats);
/**
- * Number of log calls to ignore.
+ * Get the number of log calls that are going to be skipped
+ *
+ * @return number of log calls to be ignored
*/
-extern unsigned int skip_log;
+int
+GNUNET_get_log_skip ();
#if !defined(GNUNET_CULL_LOGGING)
int
if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) { \
if (GN_UNLIKELY(log_call_enabled == -1))\
log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), (comp), __FILE__, __FUNCTION__, log_line); \
- if (GN_UNLIKELY(skip_log > 0)) {skip_log--;}\
+ if (GN_UNLIKELY(GNUNET_get_log_skip () > 0)) { GNUNET_log_skip (-1, GNUNET_NO); }\
else {\
if (GN_UNLIKELY(log_call_enabled))\
GNUNET_log_from_nocheck ((kind), comp, __VA_ARGS__); \
if ((GNUNET_EXTRA_LOGGING > 0) || ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) { \
if (GN_UNLIKELY(log_call_enabled == -1))\
log_call_enabled = GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), NULL, __FILE__, __FUNCTION__, log_line);\
- if (GN_UNLIKELY(skip_log > 0)) {skip_log--;}\
+ if (GN_UNLIKELY(GNUNET_get_log_skip () > 0)) { GNUNET_log_skip (-1, GNUNET_NO); }\
else {\
if (GN_UNLIKELY(log_call_enabled))\
GNUNET_log_nocheck ((kind), __VA_ARGS__); \
/**
* Ignore the next n calls to the log function.
*
- * @param n number of log calls to ignore
+ * @param n number of log calls to ignore (could be negative)
* @param check_reset GNUNET_YES to assert that the log skip counter is currently zero
*/
void
-GNUNET_log_skip (unsigned int n, int check_reset);
+GNUNET_log_skip (int n, int check_reset);
/**
static char *data = "ABCD";
static int result;
+
/**
* Shutdown nicely
*/
/**
* Number of log calls to ignore.
*/
-unsigned int skip_log;
+int skip_log = 0;
/**
* File descriptor to use for "stderr", or NULL for none.
/**
* Ignore the next n calls to the log function.
*
- * @param n number of log calls to ignore
+ * @param n number of log calls to ignore (could be negative)
* @param check_reset GNUNET_YES to assert that the log skip counter is currently zero
*/
void
-GNUNET_log_skip (unsigned int n, int check_reset)
+GNUNET_log_skip (int n, int check_reset)
{
int ok;
}
}
+/**
+ * Get the number of log calls that are going to be skipped
+ *
+ * @return number of log calls to be ignored
+ */
+int
+GNUNET_get_log_skip ()
+{
+ return skip_log;
+}
/**
* Output a log message using the default mechanism.