GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Stopping service `%s' within %llu ms\n"), service_name,
(unsigned long long) timeout.value);
- if (0 == strcasecmp ("arm", service_name))
+ if (h->client == NULL)
{
- if (h->client == NULL)
+ client = GNUNET_CLIENT_connect (h->sched, "arm", h->cfg);
+ if (client == NULL)
{
- client = GNUNET_CLIENT_connect (h->sched, "arm", h->cfg);
- if (client == NULL)
- {
- cb (cb_cls, GNUNET_SYSERR);
- return;
- }
- GNUNET_CLIENT_ignore_shutdown (client, GNUNET_YES);
- h->client = client;
+ cb (cb_cls, GNUNET_SYSERR);
+ return;
}
+ GNUNET_CLIENT_ignore_shutdown (client, GNUNET_YES);
+ h->client = client;
+ }
+ if (0 == strcasecmp ("arm", service_name))
+ {
arm_shutdown_ctx = GNUNET_malloc(sizeof(struct ARM_ShutdownContext));
arm_shutdown_ctx->cb = cb;
arm_shutdown_ctx->cb_cls = cb_cls;
(strcmp (pos->serviceName, serviceName) != 0) )
continue;
GNUNET_SCHEDULER_cancel (scheduler, pos->acceptTask);
- fprintf (stderr, "Closing listening socket %p\n",
- pos->listeningSocket);
GNUNET_NETWORK_socket_close (pos->listeningSocket);
GNUNET_CONTAINER_DLL_remove (serviceListeningInfoList_head,
serviceListeningInfoList_tail,
serviceListeningInfo);
return;
}
- fprintf (stderr, "Closing listening socket %p\n",
- serviceListeningInfo->listeningSocket);
GNUNET_NETWORK_socket_close (serviceListeningInfo->listeningSocket);
GNUNET_CONTAINER_DLL_remove (serviceListeningInfoList_head,
serviceListeningInfoList_tail,
{
case AF_INET:
sock = GNUNET_NETWORK_socket_create (PF_INET, SOCK_STREAM, 0);
- fprintf (stderr, "IPv4 listening at %p\n",
- sock);
break;
case AF_INET6:
sock = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0);
- fprintf (stderr, "IPv6 listening at %p\n",
- sock);
break;
default:
sock = NULL;
int main(int argc, char *const *argv)
{
- int ret;
-
- ret = (GNUNET_OK ==
- GNUNET_SERVICE_run (argc,
+ int ret;
+
+ ret = (GNUNET_OK ==
+ GNUNET_SERVICE_run (argc,
argv,
"do-nothing", GNUNET_SERVICE_OPTION_NONE,
- &run, NULL)) ? 0 : 1;
-
- return ret;
+ &run, NULL)) ? 0 : 1;
+ return ret;
}
PORT = 23354
DEFAULTSERVICES =
BINARY = gnunet-service-arm
-OPTIONS = -L DEBUG
+OPTIONS = -L ERROR
#DEBUG = YES
[resolver]
{
static struct GNUNET_CLIENT_Connection * doNothingConnection = NULL;
- if (NULL != cbData) {
- waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt);
-
+ if (NULL != cbData)
+ {
+ waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt);
+
#if LOG_BACKOFF
- fprintf(killLogFilePtr,
- "Waited for: %llu ms\n",
- (unsigned long long) waitedFor.value);
+ fprintf(killLogFilePtr,
+ "Waited for: %llu ms\n",
+ (unsigned long long) waitedFor.value);
#endif
- }
+ }
else
- waitedFor.value = 0;
+ {
+ waitedFor.value = 0;
+ }
/* Connect to the doNothing task */
doNothingConnection = GNUNET_CLIENT_connect (sched, "do-nothing", cfg);
#if LOG_BACKOFF
}
/* Use the created connection to kill the doNothingTask */
- GNUNET_CLIENT_service_shutdown(sched, doNothingConnection, TIMEOUT, &shutdown_cont, NULL);
-
+ GNUNET_CLIENT_service_shutdown(sched,
+ doNothingConnection,
+ TIMEOUT,
+ &shutdown_cont, NULL);
}
#define START_ARM GNUNET_YES
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
static int ret = 1;
if ((msg == NULL) && (shutdown_ctx->confirmed != GNUNET_YES))
{
/* Means the other side closed the connection and never confirmed a shutdown */
- GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
- "Service handle shutdown before ACK!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Service handle shutdown before ACK!\n");
if (shutdown_ctx->cont != NULL)
shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_SYSERR);
GNUNET_SCHEDULER_cancel(shutdown_ctx->sched, shutdown_ctx->cancel_task);
}
else if ((msg == NULL) && (shutdown_ctx->confirmed == GNUNET_YES))
{
- GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Service shutdown complete.\n");
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
+ "Service shutdown complete.\n");
if (shutdown_ctx->cont != NULL)
shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_NO);
{
struct GNUNET_SERVICE_Context *service = cls;
- /* FIXME: why is this call necessary???? */
GNUNET_SERVER_client_keep(client);
if (!service->allow_shutdown)
{