aboutsummaryrefslogtreecommitdiff
path: root/src/util/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/client.c')
-rw-r--r--src/util/client.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/util/client.c b/src/util/client.c
index 30c80bf03..5b753ec74 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -251,8 +251,8 @@ try_unixpath (const char *service_name,
251 struct sockaddr_un s_un; 251 struct sockaddr_un s_un;
252 252
253 unixpath = NULL; 253 unixpath = NULL;
254 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && 254 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) &&
255 (0 < strlen (unixpath))) 255 (0 < strlen (unixpath)))
256 { 256 {
257 /* We have a non-NULL unixpath, need to validate it */ 257 /* We have a non-NULL unixpath, need to validate it */
258 if (strlen (unixpath) >= sizeof (s_un.sun_path)) 258 if (strlen (unixpath) >= sizeof (s_un.sun_path))
@@ -299,8 +299,8 @@ test_service_configuration (const char *service_name,
299#if AF_UNIX 299#if AF_UNIX
300 char *unixpath = NULL; 300 char *unixpath = NULL;
301 301
302 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) && 302 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "UNIXPATH", &unixpath)) &&
303 (0 < strlen (unixpath))) 303 (0 < strlen (unixpath)))
304 ret = GNUNET_OK; 304 ret = GNUNET_OK;
305 GNUNET_free_non_null (unixpath); 305 GNUNET_free_non_null (unixpath);
306#endif 306#endif
@@ -308,7 +308,7 @@ test_service_configuration (const char *service_name,
308 if ( (GNUNET_YES == 308 if ( (GNUNET_YES ==
309 GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT")) && 309 GNUNET_CONFIGURATION_have_value (cfg, service_name, "PORT")) &&
310 (GNUNET_OK == 310 (GNUNET_OK ==
311 GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) && 311 GNUNET_CONFIGURATION_get_value_number (cfg, service_name, "PORT", &port)) &&
312 (port <= 65535) && (0 != port) && 312 (port <= 65535) && (0 != port) &&
313 (GNUNET_OK == 313 (GNUNET_OK ==
314 GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME", 314 GNUNET_CONFIGURATION_get_value_string (cfg, service_name, "HOSTNAME",
@@ -406,7 +406,7 @@ GNUNET_CLIENT_connect (const char *service_name,
406 struct GNUNET_CLIENT_Connection *client; 406 struct GNUNET_CLIENT_Connection *client;
407 struct GNUNET_CONNECTION_Handle *connection; 407 struct GNUNET_CONNECTION_Handle *connection;
408 408
409 if (GNUNET_OK != 409 if (GNUNET_OK !=
410 test_service_configuration (service_name, 410 test_service_configuration (service_name,
411 cfg)) 411 cfg))
412 return NULL; 412 return NULL;
@@ -629,7 +629,7 @@ GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *client,
629/** 629/**
630 * Handle for a test to check if a service is running. 630 * Handle for a test to check if a service is running.
631 */ 631 */
632struct GNUNET_CLIENT_TestHandle 632struct GNUNET_CLIENT_TestHandle
633{ 633{
634 /** 634 /**
635 * Function to call with the result of the test. 635 * Function to call with the result of the test.
@@ -643,7 +643,7 @@ struct GNUNET_CLIENT_TestHandle
643 643
644 /** 644 /**
645 * Client connection we are using for the test, if any. 645 * Client connection we are using for the test, if any.
646 */ 646 */
647 struct GNUNET_CLIENT_Connection *client; 647 struct GNUNET_CLIENT_Connection *client;
648 648
649 /** 649 /**
@@ -707,7 +707,7 @@ report_result (void *cls,
707 const struct GNUNET_SCHEDULER_TaskContext *tc) 707 const struct GNUNET_SCHEDULER_TaskContext *tc)
708{ 708{
709 struct GNUNET_CLIENT_TestHandle *th = cls; 709 struct GNUNET_CLIENT_TestHandle *th = cls;
710 710
711 th->task = GNUNET_SCHEDULER_NO_TASK; 711 th->task = GNUNET_SCHEDULER_NO_TASK;
712 th->cb (th->cb_cls, th->result); 712 th->cb (th->cb_cls, th->result);
713 GNUNET_CLIENT_service_test_cancel (th); 713 GNUNET_CLIENT_service_test_cancel (th);
@@ -726,7 +726,7 @@ service_test_report (struct GNUNET_CLIENT_TestHandle *th,
726{ 726{
727 th->result = result; 727 th->result = result;
728 th->task = GNUNET_SCHEDULER_add_now (&report_result, 728 th->task = GNUNET_SCHEDULER_add_now (&report_result,
729 th); 729 th);
730} 730}
731 731
732 732
@@ -775,18 +775,18 @@ write_test (void *cls, size_t size, void *buf)
775 th->th = NULL; 775 th->th = NULL;
776 if (size < sizeof (struct GNUNET_MessageHeader)) 776 if (size < sizeof (struct GNUNET_MessageHeader))
777 { 777 {
778 LOG (GNUNET_ERROR_TYPE_DEBUG, 778 LOG (GNUNET_ERROR_TYPE_DEBUG,
779 "Failed to transmit TEST request.\n"); 779 "Failed to transmit TEST request.\n");
780 service_test_report (th, GNUNET_NO); 780 service_test_report (th, GNUNET_NO);
781 return 0; /* client disconnected */ 781 return 0; /* client disconnected */
782 } 782 }
783 LOG (GNUNET_ERROR_TYPE_DEBUG, 783 LOG (GNUNET_ERROR_TYPE_DEBUG,
784 "Transmitting `%s' request.\n", 784 "Transmitting `%s' request.\n",
785 "TEST"); 785 "TEST");
786 msg = (struct GNUNET_MessageHeader *) buf; 786 msg = (struct GNUNET_MessageHeader *) buf;
787 msg->type = htons (GNUNET_MESSAGE_TYPE_TEST); 787 msg->type = htons (GNUNET_MESSAGE_TYPE_TEST);
788 msg->size = htons (sizeof (struct GNUNET_MessageHeader)); 788 msg->size = htons (sizeof (struct GNUNET_MessageHeader));
789 GNUNET_CLIENT_receive (th->client, 789 GNUNET_CLIENT_receive (th->client,
790 &confirm_handler, th, 790 &confirm_handler, th,
791 GNUNET_TIME_absolute_get_remaining 791 GNUNET_TIME_absolute_get_remaining
792 (th->test_deadline)); 792 (th->test_deadline));
@@ -822,7 +822,7 @@ GNUNET_CLIENT_service_test (const char *service,
822 th->cb = cb; 822 th->cb = cb;
823 th->cb_cls = cb_cls; 823 th->cb_cls = cb_cls;
824 th->test_deadline = GNUNET_TIME_relative_to_absolute (timeout); 824 th->test_deadline = GNUNET_TIME_relative_to_absolute (timeout);
825 LOG (GNUNET_ERROR_TYPE_DEBUG, 825 LOG (GNUNET_ERROR_TYPE_DEBUG,
826 "Testing if service `%s' is running.\n", 826 "Testing if service `%s' is running.\n",
827 service); 827 service);
828#ifdef AF_UNIX 828#ifdef AF_UNIX
@@ -874,7 +874,7 @@ GNUNET_CLIENT_service_test (const char *service,
874 service_test_report (th, GNUNET_YES); 874 service_test_report (th, GNUNET_YES);
875 return th; 875 return th;
876 } 876 }
877 (void) GNUNET_NETWORK_socket_close (sock); 877 (void) GNUNET_NETWORK_socket_close (sock);
878 /* let's try IP */ 878 /* let's try IP */
879 } 879 }
880 } 880 }
@@ -1026,7 +1026,7 @@ client_delayed_retry (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1026{ 1026{
1027 struct GNUNET_CLIENT_TransmitHandle *th = cls; 1027 struct GNUNET_CLIENT_TransmitHandle *th = cls;
1028 struct GNUNET_TIME_Relative delay; 1028 struct GNUNET_TIME_Relative delay;
1029 1029
1030 th->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 1030 th->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
1031 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) 1031 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
1032 { 1032 {
@@ -1116,7 +1116,7 @@ client_notify (void *cls, size_t size, void *buf)
1116 { 1116 {
1117 GNUNET_CONNECTION_receive_cancel (client->connection); 1117 GNUNET_CONNECTION_receive_cancel (client->connection);
1118 client->in_receive = GNUNET_NO; 1118 client->in_receive = GNUNET_NO;
1119 } 1119 }
1120 GNUNET_CONNECTION_destroy (client->connection); 1120 GNUNET_CONNECTION_destroy (client->connection);
1121 client->connection = NULL; 1121 client->connection = NULL;
1122 delay = GNUNET_TIME_relative_min (delay, client->back_off); 1122 delay = GNUNET_TIME_relative_min (delay, client->back_off);