aboutsummaryrefslogtreecommitdiff
path: root/src/arm/arm_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arm/arm_api.c')
-rw-r--r--src/arm/arm_api.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index f844551e4..6dfe65702 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -243,7 +243,7 @@ reconnect_arm_later (struct GNUNET_ARM_Handle *h)
243 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task); 243 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task);
244 h->reconnect_task = 244 h->reconnect_task =
245 GNUNET_SCHEDULER_add_delayed (h->retry_backoff, &reconnect_arm_task, h); 245 GNUNET_SCHEDULER_add_delayed (h->retry_backoff, &reconnect_arm_task, h);
246 /* Don't clear pending messages on disconnection, deliver them later 246 /* Don't clear pending messages on disconnection, deliver them later
247 clear_pending_messages (h, GNUNET_ARM_REQUEST_DISCONNECTED); 247 clear_pending_messages (h, GNUNET_ARM_REQUEST_DISCONNECTED);
248 GNUNET_assert (NULL == h->control_pending_head); 248 GNUNET_assert (NULL == h->control_pending_head);
249 */ 249 */
@@ -285,7 +285,7 @@ arm_termination_handler (void *cls, const struct GNUNET_MessageHeader *msg)
285 285
286 if (NULL != msg) 286 if (NULL != msg)
287 { 287 {
288 GNUNET_break (0); 288 GNUNET_break (0);
289 GNUNET_CLIENT_receive (h->client, &arm_termination_handler, h, 289 GNUNET_CLIENT_receive (h->client, &arm_termination_handler, h,
290 GNUNET_TIME_UNIT_FOREVER_REL); 290 GNUNET_TIME_UNIT_FOREVER_REL);
291 return; 291 return;
@@ -296,10 +296,10 @@ arm_termination_handler (void *cls, const struct GNUNET_MessageHeader *msg)
296 GNUNET_CLIENT_disconnect (h->client); 296 GNUNET_CLIENT_disconnect (h->client);
297 h->client = NULL; 297 h->client = NULL;
298 if (NULL != cm->result_cont) 298 if (NULL != cm->result_cont)
299 cm->result_cont (cm->cont_cls, 299 cm->result_cont (cm->cont_cls,
300 GNUNET_ARM_REQUEST_SENT_OK, 300 GNUNET_ARM_REQUEST_SENT_OK,
301 (const char *) &cm->msg[1], 301 (const char *) &cm->msg[1],
302 GNUNET_ARM_RESULT_STOPPED); 302 GNUNET_ARM_RESULT_STOPPED);
303 GNUNET_free (cm->msg); 303 GNUNET_free (cm->msg);
304 GNUNET_free (cm); 304 GNUNET_free (cm);
305} 305}
@@ -354,7 +354,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
354 { 354 {
355 LOG (GNUNET_ERROR_TYPE_DEBUG, "Message with unknown id %llu\n", id); 355 LOG (GNUNET_ERROR_TYPE_DEBUG, "Message with unknown id %llu\n", id);
356 return; 356 return;
357 } 357 }
358 fail = GNUNET_NO; 358 fail = GNUNET_NO;
359 switch (ntohs (msg->type)) 359 switch (ntohs (msg->type))
360 { 360 {
@@ -377,7 +377,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
377 rcount = ntohs (lres->count); 377 rcount = ntohs (lres->count);
378 { 378 {
379 unsigned int i; 379 unsigned int i;
380 380
381 list = GNUNET_malloc (sizeof (const char *) * rcount); 381 list = GNUNET_malloc (sizeof (const char *) * rcount);
382 pos = (const char *)&lres[1]; 382 pos = (const char *)&lres[1];
383 for (i = 0; i < rcount; i++) 383 for (i = 0; i < rcount; i++)
@@ -429,9 +429,9 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
429 if (NULL != h->thm) 429 if (NULL != h->thm)
430 { 430 {
431 GNUNET_break (0); 431 GNUNET_break (0);
432 cm->result_cont (h->thm->cont_cls, 432 cm->result_cont (h->thm->cont_cls,
433 GNUNET_ARM_REQUEST_SENT_OK, 433 GNUNET_ARM_REQUEST_SENT_OK,
434 (const char *) &h->thm->msg[1], 434 (const char *) &h->thm->msg[1],
435 GNUNET_ARM_RESULT_IS_NOT_KNOWN); 435 GNUNET_ARM_RESULT_IS_NOT_KNOWN);
436 GNUNET_free (h->thm->msg); 436 GNUNET_free (h->thm->msg);
437 GNUNET_free (h->thm); 437 GNUNET_free (h->thm);
@@ -440,12 +440,12 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
440 GNUNET_CLIENT_receive (h->client, &arm_termination_handler, h, 440 GNUNET_CLIENT_receive (h->client, &arm_termination_handler, h,
441 GNUNET_TIME_UNIT_FOREVER_REL); 441 GNUNET_TIME_UNIT_FOREVER_REL);
442 return; 442 return;
443 } 443 }
444 GNUNET_CLIENT_receive (h->client, &client_notify_handler, h, 444 GNUNET_CLIENT_receive (h->client, &client_notify_handler, h,
445 GNUNET_TIME_UNIT_FOREVER_REL); 445 GNUNET_TIME_UNIT_FOREVER_REL);
446 switch (ntohs (msg->type)) 446 switch (ntohs (msg->type))
447 { 447 {
448 case GNUNET_MESSAGE_TYPE_ARM_RESULT: 448 case GNUNET_MESSAGE_TYPE_ARM_RESULT:
449 res = (const struct GNUNET_ARM_ResultMessage *) msg; 449 res = (const struct GNUNET_ARM_ResultMessage *) msg;
450 LOG (GNUNET_ERROR_TYPE_DEBUG, 450 LOG (GNUNET_ERROR_TYPE_DEBUG,
451 "Received response from ARM for service `%s': %u\n", 451 "Received response from ARM for service `%s': %u\n",
@@ -461,7 +461,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
461 list); 461 list);
462 GNUNET_free (list); 462 GNUNET_free (list);
463 break; 463 break;
464 } 464 }
465 GNUNET_free (cm->msg); 465 GNUNET_free (cm->msg);
466 GNUNET_free (cm); 466 GNUNET_free (cm);
467} 467}
@@ -473,7 +473,7 @@ client_notify_handler (void *cls, const struct GNUNET_MessageHeader *msg)
473 * @param cls closure with the 'struct GNUNET_ARM_Handle' 473 * @param cls closure with the 'struct GNUNET_ARM_Handle'
474 * @param size number of bytes available in buf 474 * @param size number of bytes available in buf
475 * @param buf where the callee should write the message 475 * @param buf where the callee should write the message
476 * @return number of bytes written to buf 476 * @return number of bytes written to buf
477 */ 477 */
478static size_t 478static size_t
479transmit_arm_message (void *cls, size_t size, void *buf) 479transmit_arm_message (void *cls, size_t size, void *buf)
@@ -490,7 +490,7 @@ transmit_arm_message (void *cls, size_t size, void *buf)
490 "transmit_arm_message is running with %p buffer of size %lu. ARM is known to be %s\n", 490 "transmit_arm_message is running with %p buffer of size %lu. ARM is known to be %s\n",
491 buf, size, h->currently_down ? "unconnected" : "connected"); 491 buf, size, h->currently_down ? "unconnected" : "connected");
492 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task); 492 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == h->reconnect_task);
493 h->cth = NULL; 493 h->cth = NULL;
494 if ((GNUNET_YES == h->currently_down) && (NULL != buf)) 494 if ((GNUNET_YES == h->currently_down) && (NULL != buf))
495 { 495 {
496 h->currently_down = GNUNET_NO; 496 h->currently_down = GNUNET_NO;
@@ -658,14 +658,14 @@ void
658GNUNET_ARM_disconnect_and_free (struct GNUNET_ARM_Handle *h) 658GNUNET_ARM_disconnect_and_free (struct GNUNET_ARM_Handle *h)
659{ 659{
660 struct ARMControlMessage *cm; 660 struct ARMControlMessage *cm;
661 661
662 LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from ARM service\n"); 662 LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from ARM service\n");
663 if (NULL != h->cth) 663 if (NULL != h->cth)
664 { 664 {
665 GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth); 665 GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth);
666 h->cth = NULL; 666 h->cth = NULL;
667 } 667 }
668 while ((NULL != (cm = h->control_pending_head)) 668 while ((NULL != (cm = h->control_pending_head))
669 || (NULL != (cm = h->control_sent_head)) ) 669 || (NULL != (cm = h->control_sent_head)) )
670 { 670 {
671 if (NULL != h->control_pending_head) 671 if (NULL != h->control_pending_head)
@@ -764,13 +764,13 @@ arm_service_report (void *cls,
764 if ((GNUNET_YES == test_is_active) && 764 if ((GNUNET_YES == test_is_active) &&
765 (GNUNET_YES == result)) 765 (GNUNET_YES == result))
766 { 766 {
767 LOG (GNUNET_ERROR_TYPE_DEBUG, 767 LOG (GNUNET_ERROR_TYPE_DEBUG,
768 "Looks like `%s' is already running.\n", 768 "Looks like `%s' is already running.\n",
769 "gnunet-service-arm"); 769 "gnunet-service-arm");
770 /* arm is running! */ 770 /* arm is running! */
771 if (cm->result_cont) 771 if (cm->result_cont)
772 cm->result_cont (cm->cont_cls, 772 cm->result_cont (cm->cont_cls,
773 GNUNET_ARM_REQUEST_SENT_OK, "arm", 773 GNUNET_ARM_REQUEST_SENT_OK, "arm",
774 GNUNET_ARM_RESULT_IS_STARTED_ALREADY); 774 GNUNET_ARM_RESULT_IS_STARTED_ALREADY);
775 } 775 }
776 if (GNUNET_NO == test_is_active) 776 if (GNUNET_NO == test_is_active)
@@ -802,8 +802,8 @@ arm_service_report (void *cls,
802 { 802 {
803 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, "arm", "BINARY"); 803 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_WARNING, "arm", "BINARY");
804 if (cm->result_cont) 804 if (cm->result_cont)
805 cm->result_cont (cm->cont_cls, 805 cm->result_cont (cm->cont_cls,
806 GNUNET_ARM_REQUEST_SENT_OK, "arm", 806 GNUNET_ARM_REQUEST_SENT_OK, "arm",
807 GNUNET_ARM_RESULT_IS_NOT_KNOWN); 807 GNUNET_ARM_RESULT_IS_NOT_KNOWN);
808 GNUNET_free (cm); 808 GNUNET_free (cm);
809 GNUNET_free (loprefix); 809 GNUNET_free (loprefix);
@@ -935,9 +935,9 @@ change_service (struct GNUNET_ARM_Handle *h, const char *service_name,
935 */ 935 */
936void 936void
937GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, 937GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
938 const char *service_name, 938 const char *service_name,
939 enum GNUNET_OS_InheritStdioFlags std_inheritance, 939 enum GNUNET_OS_InheritStdioFlags std_inheritance,
940 struct GNUNET_TIME_Relative timeout, 940 struct GNUNET_TIME_Relative timeout,
941 GNUNET_ARM_ResultCallback cont, 941 GNUNET_ARM_ResultCallback cont,
942 void *cont_cls) 942 void *cont_cls)
943{ 943{
@@ -1026,14 +1026,14 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
1026 */ 1026 */
1027void 1027void
1028GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, 1028GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h,
1029 const char *service_name, 1029 const char *service_name,
1030 struct GNUNET_TIME_Relative timeout, 1030 struct GNUNET_TIME_Relative timeout,
1031 GNUNET_ARM_ResultCallback cont, 1031 GNUNET_ARM_ResultCallback cont,
1032 void *cont_cls) 1032 void *cont_cls)
1033{ 1033{
1034 LOG (GNUNET_ERROR_TYPE_DEBUG, 1034 LOG (GNUNET_ERROR_TYPE_DEBUG,
1035 "Stopping service `%s' within %s\n", 1035 "Stopping service `%s' within %s\n",
1036 service_name, 1036 service_name,
1037 GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO)); 1037 GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_NO));
1038 change_service (h, service_name, timeout, cont, cont_cls, 1038 change_service (h, service_name, timeout, cont, cont_cls,
1039 GNUNET_MESSAGE_TYPE_ARM_STOP); 1039 GNUNET_MESSAGE_TYPE_ARM_STOP);
@@ -1051,14 +1051,14 @@ GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h,
1051void 1051void
1052GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h, 1052GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h,
1053 struct GNUNET_TIME_Relative timeout, 1053 struct GNUNET_TIME_Relative timeout,
1054 GNUNET_ARM_ServiceListCallback cont, 1054 GNUNET_ARM_ServiceListCallback cont,
1055 void *cont_cls) 1055 void *cont_cls)
1056{ 1056{
1057 struct ARMControlMessage *cm; 1057 struct ARMControlMessage *cm;
1058 struct GNUNET_ARM_Message *msg; 1058 struct GNUNET_ARM_Message *msg;
1059 1059
1060 LOG (GNUNET_ERROR_TYPE_DEBUG, 1060 LOG (GNUNET_ERROR_TYPE_DEBUG,
1061 "Requesting LIST from ARM service with timeout: %s\n", 1061 "Requesting LIST from ARM service with timeout: %s\n",
1062 GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_YES)); 1062 GNUNET_STRINGS_relative_time_to_string (timeout, GNUNET_YES));
1063 cm = GNUNET_malloc (sizeof (struct ARMControlMessage)); 1063 cm = GNUNET_malloc (sizeof (struct ARMControlMessage));
1064 cm->h = h; 1064 cm->h = h;