aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-05-11 12:56:52 +0000
committerChristian Grothoff <christian@grothoff.org>2010-05-11 12:56:52 +0000
commit647428d5ed0708276983bca2bc91e430bf2b6a6e (patch)
tree911df32372f1401747e2a76c6804d51487dc4f1b /src
parentb339446660675ff6c80018827128f9638d79de8f (diff)
downloadgnunet-647428d5ed0708276983bca2bc91e430bf2b6a6e.tar.gz
gnunet-647428d5ed0708276983bca2bc91e430bf2b6a6e.zip
stuff
Diffstat (limited to 'src')
-rw-r--r--src/arm/arm_api.c20
-rw-r--r--src/arm/gnunet-service-manager.c8
-rw-r--r--src/arm/mockup-service.c13
-rw-r--r--src/arm/test_arm_api_data.conf2
-rw-r--r--src/arm/test_exponential_backoff.c25
-rw-r--r--src/arm/test_gnunet_service_manager.c2
-rw-r--r--src/util/client.c7
-rw-r--r--src/util/service.c1
8 files changed, 37 insertions, 41 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index 26ed590a2..ee53fd87b 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -482,19 +482,19 @@ GNUNET_ARM_stop_service (struct GNUNET_ARM_Handle *h,
482 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 482 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
483 _("Stopping service `%s' within %llu ms\n"), service_name, 483 _("Stopping service `%s' within %llu ms\n"), service_name,
484 (unsigned long long) timeout.value); 484 (unsigned long long) timeout.value);
485 if (0 == strcasecmp ("arm", service_name)) 485 if (h->client == NULL)
486 { 486 {
487 if (h->client == NULL) 487 client = GNUNET_CLIENT_connect (h->sched, "arm", h->cfg);
488 if (client == NULL)
488 { 489 {
489 client = GNUNET_CLIENT_connect (h->sched, "arm", h->cfg); 490 cb (cb_cls, GNUNET_SYSERR);
490 if (client == NULL) 491 return;
491 {
492 cb (cb_cls, GNUNET_SYSERR);
493 return;
494 }
495 GNUNET_CLIENT_ignore_shutdown (client, GNUNET_YES);
496 h->client = client;
497 } 492 }
493 GNUNET_CLIENT_ignore_shutdown (client, GNUNET_YES);
494 h->client = client;
495 }
496 if (0 == strcasecmp ("arm", service_name))
497 {
498 arm_shutdown_ctx = GNUNET_malloc(sizeof(struct ARM_ShutdownContext)); 498 arm_shutdown_ctx = GNUNET_malloc(sizeof(struct ARM_ShutdownContext));
499 arm_shutdown_ctx->cb = cb; 499 arm_shutdown_ctx->cb = cb;
500 arm_shutdown_ctx->cb_cls = cb_cls; 500 arm_shutdown_ctx->cb_cls = cb_cls;
diff --git a/src/arm/gnunet-service-manager.c b/src/arm/gnunet-service-manager.c
index 8eb3847c4..a55991050 100644
--- a/src/arm/gnunet-service-manager.c
+++ b/src/arm/gnunet-service-manager.c
@@ -571,8 +571,6 @@ void stop_listening (const char *serviceName)
571 (strcmp (pos->serviceName, serviceName) != 0) ) 571 (strcmp (pos->serviceName, serviceName) != 0) )
572 continue; 572 continue;
573 GNUNET_SCHEDULER_cancel (scheduler, pos->acceptTask); 573 GNUNET_SCHEDULER_cancel (scheduler, pos->acceptTask);
574 fprintf (stderr, "Closing listening socket %p\n",
575 pos->listeningSocket);
576 GNUNET_NETWORK_socket_close (pos->listeningSocket); 574 GNUNET_NETWORK_socket_close (pos->listeningSocket);
577 GNUNET_CONTAINER_DLL_remove (serviceListeningInfoList_head, 575 GNUNET_CONTAINER_DLL_remove (serviceListeningInfoList_head,
578 serviceListeningInfoList_tail, 576 serviceListeningInfoList_tail,
@@ -623,8 +621,6 @@ acceptConnection (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
623 serviceListeningInfo); 621 serviceListeningInfo);
624 return; 622 return;
625 } 623 }
626 fprintf (stderr, "Closing listening socket %p\n",
627 serviceListeningInfo->listeningSocket);
628 GNUNET_NETWORK_socket_close (serviceListeningInfo->listeningSocket); 624 GNUNET_NETWORK_socket_close (serviceListeningInfo->listeningSocket);
629 GNUNET_CONTAINER_DLL_remove (serviceListeningInfoList_head, 625 GNUNET_CONTAINER_DLL_remove (serviceListeningInfoList_head,
630 serviceListeningInfoList_tail, 626 serviceListeningInfoList_tail,
@@ -660,13 +656,9 @@ createListeningSocket (struct sockaddr *sa,
660 { 656 {
661 case AF_INET: 657 case AF_INET:
662 sock = GNUNET_NETWORK_socket_create (PF_INET, SOCK_STREAM, 0); 658 sock = GNUNET_NETWORK_socket_create (PF_INET, SOCK_STREAM, 0);
663 fprintf (stderr, "IPv4 listening at %p\n",
664 sock);
665 break; 659 break;
666 case AF_INET6: 660 case AF_INET6:
667 sock = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0); 661 sock = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_STREAM, 0);
668 fprintf (stderr, "IPv6 listening at %p\n",
669 sock);
670 break; 662 break;
671 default: 663 default:
672 sock = NULL; 664 sock = NULL;
diff --git a/src/arm/mockup-service.c b/src/arm/mockup-service.c
index 2de957ba9..fbc6b04ba 100644
--- a/src/arm/mockup-service.c
+++ b/src/arm/mockup-service.c
@@ -41,13 +41,12 @@ run (void *cls,
41 41
42int main(int argc, char *const *argv) 42int main(int argc, char *const *argv)
43{ 43{
44 int ret; 44 int ret;
45 45
46 ret = (GNUNET_OK == 46 ret = (GNUNET_OK ==
47 GNUNET_SERVICE_run (argc, 47 GNUNET_SERVICE_run (argc,
48 argv, 48 argv,
49 "do-nothing", GNUNET_SERVICE_OPTION_NONE, 49 "do-nothing", GNUNET_SERVICE_OPTION_NONE,
50 &run, NULL)) ? 0 : 1; 50 &run, NULL)) ? 0 : 1;
51 51 return ret;
52 return ret;
53} 52}
diff --git a/src/arm/test_arm_api_data.conf b/src/arm/test_arm_api_data.conf
index adfab9b8f..17a8ac613 100644
--- a/src/arm/test_arm_api_data.conf
+++ b/src/arm/test_arm_api_data.conf
@@ -6,7 +6,7 @@ DEFAULTCONFIG = test_arm_api_data.conf
6PORT = 23354 6PORT = 23354
7DEFAULTSERVICES = 7DEFAULTSERVICES =
8BINARY = gnunet-service-arm 8BINARY = gnunet-service-arm
9OPTIONS = -L DEBUG 9OPTIONS = -L ERROR
10#DEBUG = YES 10#DEBUG = YES
11 11
12[resolver] 12[resolver]
diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c
index 357a5e71a..8657563fc 100644
--- a/src/arm/test_exponential_backoff.c
+++ b/src/arm/test_exponential_backoff.c
@@ -147,17 +147,20 @@ kill_task (void *cbData,
147{ 147{
148 static struct GNUNET_CLIENT_Connection * doNothingConnection = NULL; 148 static struct GNUNET_CLIENT_Connection * doNothingConnection = NULL;
149 149
150 if (NULL != cbData) { 150 if (NULL != cbData)
151 waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt); 151 {
152 152 waitedFor = GNUNET_TIME_absolute_get_duration (startedWaitingAt);
153
153#if LOG_BACKOFF 154#if LOG_BACKOFF
154 fprintf(killLogFilePtr, 155 fprintf(killLogFilePtr,
155 "Waited for: %llu ms\n", 156 "Waited for: %llu ms\n",
156 (unsigned long long) waitedFor.value); 157 (unsigned long long) waitedFor.value);
157#endif 158#endif
158 } 159 }
159 else 160 else
160 waitedFor.value = 0; 161 {
162 waitedFor.value = 0;
163 }
161 /* Connect to the doNothing task */ 164 /* Connect to the doNothing task */
162 doNothingConnection = GNUNET_CLIENT_connect (sched, "do-nothing", cfg); 165 doNothingConnection = GNUNET_CLIENT_connect (sched, "do-nothing", cfg);
163#if LOG_BACKOFF 166#if LOG_BACKOFF
@@ -175,8 +178,10 @@ kill_task (void *cbData,
175 } 178 }
176 179
177 /* Use the created connection to kill the doNothingTask */ 180 /* Use the created connection to kill the doNothingTask */
178 GNUNET_CLIENT_service_shutdown(sched, doNothingConnection, TIMEOUT, &shutdown_cont, NULL); 181 GNUNET_CLIENT_service_shutdown(sched,
179 182 doNothingConnection,
183 TIMEOUT,
184 &shutdown_cont, NULL);
180} 185}
181 186
182 187
diff --git a/src/arm/test_gnunet_service_manager.c b/src/arm/test_gnunet_service_manager.c
index 9878dca17..454fa0e98 100644
--- a/src/arm/test_gnunet_service_manager.c
+++ b/src/arm/test_gnunet_service_manager.c
@@ -38,7 +38,7 @@
38 38
39#define START_ARM GNUNET_YES 39#define START_ARM GNUNET_YES
40 40
41#define VERBOSE GNUNET_YES 41#define VERBOSE GNUNET_NO
42 42
43static int ret = 1; 43static int ret = 1;
44 44
diff --git a/src/util/client.c b/src/util/client.c
index 588957d85..55eb68d13 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -602,8 +602,8 @@ service_shutdown_handler (void *cls, const struct GNUNET_MessageHeader *msg)
602 if ((msg == NULL) && (shutdown_ctx->confirmed != GNUNET_YES)) 602 if ((msg == NULL) && (shutdown_ctx->confirmed != GNUNET_YES))
603 { 603 {
604 /* Means the other side closed the connection and never confirmed a shutdown */ 604 /* Means the other side closed the connection and never confirmed a shutdown */
605 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, 605 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
606 "Service handle shutdown before ACK!\n"); 606 "Service handle shutdown before ACK!\n");
607 if (shutdown_ctx->cont != NULL) 607 if (shutdown_ctx->cont != NULL)
608 shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_SYSERR); 608 shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_SYSERR);
609 GNUNET_SCHEDULER_cancel(shutdown_ctx->sched, shutdown_ctx->cancel_task); 609 GNUNET_SCHEDULER_cancel(shutdown_ctx->sched, shutdown_ctx->cancel_task);
@@ -612,7 +612,8 @@ service_shutdown_handler (void *cls, const struct GNUNET_MessageHeader *msg)
612 } 612 }
613 else if ((msg == NULL) && (shutdown_ctx->confirmed == GNUNET_YES)) 613 else if ((msg == NULL) && (shutdown_ctx->confirmed == GNUNET_YES))
614 { 614 {
615 GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Service shutdown complete.\n"); 615 GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
616 "Service shutdown complete.\n");
616 if (shutdown_ctx->cont != NULL) 617 if (shutdown_ctx->cont != NULL)
617 shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_NO); 618 shutdown_ctx->cont(shutdown_ctx->cont_cls, GNUNET_NO);
618 619
diff --git a/src/util/service.c b/src/util/service.c
index 2c2e7d8df..2214efe10 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -628,7 +628,6 @@ handle_shutdown (void *cls,
628{ 628{
629 struct GNUNET_SERVICE_Context *service = cls; 629 struct GNUNET_SERVICE_Context *service = cls;
630 630
631 /* FIXME: why is this call necessary???? */
632 GNUNET_SERVER_client_keep(client); 631 GNUNET_SERVER_client_keep(client);
633 if (!service->allow_shutdown) 632 if (!service->allow_shutdown)
634 { 633 {