diff options
author | LRN <lrn1986@gmail.com> | 2013-03-20 18:50:18 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2013-03-20 18:50:18 +0000 |
commit | 346748a3a55e197fe206e87b0520cef85ab9fda3 (patch) | |
tree | 37bc351cba1af84ee12e8d5dcd6d596f0456da3f /src/arm/test_arm_api.c | |
parent | 41646c7ce6e3d1711beb4b95da08afbd5b79d097 (diff) | |
download | gnunet-346748a3a55e197fe206e87b0520cef85ab9fda3.tar.gz gnunet-346748a3a55e197fe206e87b0520cef85ab9fda3.zip |
Simplify ARM alloc/connect
Diffstat (limited to 'src/arm/test_arm_api.c')
-rw-r--r-- | src/arm/test_arm_api.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/arm/test_arm_api.c b/src/arm/test_arm_api.c index 865f3dfa0..65e8b7797 100644 --- a/src/arm/test_arm_api.c +++ b/src/arm/test_arm_api.c | |||
@@ -71,7 +71,7 @@ resolver_stop_cb (void *cls, struct GNUNET_ARM_Handle *h, enum GNUNET_ARM_Reques | |||
71 | GNUNET_ARM_request_service_stop (arm, "arm", TIMEOUT, arm_stop_cb, NULL); | 71 | GNUNET_ARM_request_service_stop (arm, "arm", TIMEOUT, arm_stop_cb, NULL); |
72 | #else | 72 | #else |
73 | arm_stop_cb (NULL, GNUNET_ARM_STATUS_SENT_OK, "arm", GNUNET_ARM_SERVICE_STOPPING); | 73 | arm_stop_cb (NULL, GNUNET_ARM_STATUS_SENT_OK, "arm", GNUNET_ARM_SERVICE_STOPPING); |
74 | arm_conn (NULL, GNUNET_NO, GNUNET_NO); | 74 | arm_conn (NULL, GNUNET_NO); |
75 | #endif | 75 | #endif |
76 | } | 76 | } |
77 | 77 | ||
@@ -119,9 +119,9 @@ trigger_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
119 | 119 | ||
120 | 120 | ||
121 | void | 121 | void |
122 | arm_conn (void *cls, struct GNUNET_ARM_Handle *arm, unsigned char connected, unsigned char error) | 122 | arm_conn (void *cls, struct GNUNET_ARM_Handle *arm, char connected) |
123 | { | 123 | { |
124 | if (GNUNET_YES == error) | 124 | if (GNUNET_SYSERR == connected) |
125 | { | 125 | { |
126 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 126 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
127 | _("Fatal error initializing ARM API.\n")); | 127 | _("Fatal error initializing ARM API.\n")); |
@@ -129,7 +129,7 @@ arm_conn (void *cls, struct GNUNET_ARM_Handle *arm, unsigned char connected, uns | |||
129 | GNUNET_assert (0); | 129 | GNUNET_assert (0); |
130 | return; | 130 | return; |
131 | } | 131 | } |
132 | if (connected) | 132 | if (GNUNET_YES == connected) |
133 | { | 133 | { |
134 | /* (1), arm connection should be established */ | 134 | /* (1), arm connection should be established */ |
135 | FPRINTF (stderr, "%s", "Connected to ARM\n"); | 135 | FPRINTF (stderr, "%s", "Connected to ARM\n"); |
@@ -201,13 +201,14 @@ task (void *cls, char *const *args, const char *cfgfile, | |||
201 | else | 201 | else |
202 | GNUNET_free (armconfig); | 202 | GNUNET_free (armconfig); |
203 | } | 203 | } |
204 | arm = GNUNET_ARM_alloc (cfg); | 204 | arm = GNUNET_ARM_connect (cfg, arm_conn, NULL); |
205 | GNUNET_ARM_connect (arm, arm_conn, NULL); | 205 | if (NULL == arm) |
206 | return; | ||
206 | #if START_ARM | 207 | #if START_ARM |
207 | GNUNET_ARM_request_service_start (arm, "arm", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, arm_start_cb, NULL); | 208 | GNUNET_ARM_request_service_start (arm, "arm", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, arm_start_cb, NULL); |
208 | #else | 209 | #else |
209 | arm_start_cb (NULL, arm, GNUNET_ARM_REQUEST_SENT_OK, "arm", GNUNET_ARM_RESULT_STARTING); | 210 | arm_start_cb (NULL, arm, GNUNET_ARM_REQUEST_SENT_OK, "arm", GNUNET_ARM_RESULT_STARTING); |
210 | arm_conn (NULL, GNUNET_YES, GNUNET_NO); | 211 | arm_conn (NULL, arm, GNUNET_YES); |
211 | #endif | 212 | #endif |
212 | } | 213 | } |
213 | 214 | ||