diff options
-rw-r--r-- | src/ats/ats_api_connectivity.c | 15 | ||||
-rw-r--r-- | src/ats/ats_api_scheduling.c | 14 | ||||
-rw-r--r-- | src/consensus/consensus_api.c | 13 | ||||
-rw-r--r-- | src/peerstore/peerstore_api.c | 13 | ||||
-rw-r--r-- | src/rps/rps_api.c | 12 | ||||
-rw-r--r-- | src/secretsharing/secretsharing_api.c | 37 | ||||
-rw-r--r-- | src/set/set_api.c | 16 | ||||
-rw-r--r-- | src/util/test_mq_client.c | 8 |
8 files changed, 58 insertions, 70 deletions
diff --git a/src/ats/ats_api_connectivity.c b/src/ats/ats_api_connectivity.c index 139f50a81..790d3e4cb 100644 --- a/src/ats/ats_api_connectivity.c +++ b/src/ats/ats_api_connectivity.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2010-2015 GNUnet e.V. | 3 | Copyright (C) 2010-2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -193,19 +193,18 @@ reconnect (struct GNUNET_ATS_ConnectivityHandle *ch) | |||
193 | { { NULL, 0, 0 } }; | 193 | { { NULL, 0, 0 } }; |
194 | struct GNUNET_MQ_Envelope *ev; | 194 | struct GNUNET_MQ_Envelope *ev; |
195 | struct ClientStartMessage *init; | 195 | struct ClientStartMessage *init; |
196 | struct GNUNET_CLIENT_Connection *client; | ||
197 | 196 | ||
198 | GNUNET_assert (NULL == ch->mq); | 197 | GNUNET_assert (NULL == ch->mq); |
199 | client = GNUNET_CLIENT_connect ("ats", ch->cfg); | 198 | ch->mq = GNUNET_CLIENT_connecT (ch->cfg, |
200 | if (NULL == client) | 199 | "ats", |
200 | handlers, | ||
201 | &error_handler, | ||
202 | ch); | ||
203 | if (NULL == ch->mq) | ||
201 | { | 204 | { |
202 | force_reconnect (ch); | 205 | force_reconnect (ch); |
203 | return; | 206 | return; |
204 | } | 207 | } |
205 | ch->mq = GNUNET_MQ_queue_for_connection_client (client, | ||
206 | handlers, | ||
207 | &error_handler, | ||
208 | ch); | ||
209 | ev = GNUNET_MQ_msg (init, | 208 | ev = GNUNET_MQ_msg (init, |
210 | GNUNET_MESSAGE_TYPE_ATS_START); | 209 | GNUNET_MESSAGE_TYPE_ATS_START); |
211 | init->start_flag = htonl (START_FLAG_CONNECTION_SUGGESTION); | 210 | init->start_flag = htonl (START_FLAG_CONNECTION_SUGGESTION); |
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index d7e305950..bcca89456 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c | |||
@@ -529,21 +529,19 @@ reconnect (struct GNUNET_ATS_SchedulingHandle *sh) | |||
529 | struct ClientStartMessage *init; | 529 | struct ClientStartMessage *init; |
530 | unsigned int i; | 530 | unsigned int i; |
531 | struct GNUNET_ATS_AddressRecord *ar; | 531 | struct GNUNET_ATS_AddressRecord *ar; |
532 | struct GNUNET_CLIENT_Connection *client; | ||
533 | 532 | ||
534 | GNUNET_assert (NULL == sh->mq); | 533 | GNUNET_assert (NULL == sh->mq); |
535 | client = GNUNET_CLIENT_connect ("ats", | 534 | sh->mq = GNUNET_CLIENT_connecT (sh->cfg, |
536 | sh->cfg); | 535 | "ats", |
537 | if (NULL == client) | 536 | handlers, |
537 | &error_handler, | ||
538 | sh); | ||
539 | if (NULL == sh->mq) | ||
538 | { | 540 | { |
539 | GNUNET_break (0); | 541 | GNUNET_break (0); |
540 | force_reconnect (sh); | 542 | force_reconnect (sh); |
541 | return; | 543 | return; |
542 | } | 544 | } |
543 | sh->mq = GNUNET_MQ_queue_for_connection_client (client, | ||
544 | handlers, | ||
545 | &error_handler, | ||
546 | sh); | ||
547 | ev = GNUNET_MQ_msg (init, | 545 | ev = GNUNET_MQ_msg (init, |
548 | GNUNET_MESSAGE_TYPE_ATS_START); | 546 | GNUNET_MESSAGE_TYPE_ATS_START); |
549 | init->start_flag = htonl (START_FLAG_SCHEDULING); | 547 | init->start_flag = htonl (START_FLAG_SCHEDULING); |
diff --git a/src/consensus/consensus_api.c b/src/consensus/consensus_api.c index 7e7bb3fcf..2eebcc439 100644 --- a/src/consensus/consensus_api.c +++ b/src/consensus/consensus_api.c | |||
@@ -217,22 +217,21 @@ GNUNET_CONSENSUS_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
217 | }; | 217 | }; |
218 | struct GNUNET_CONSENSUS_JoinMessage *join_msg; | 218 | struct GNUNET_CONSENSUS_JoinMessage *join_msg; |
219 | struct GNUNET_MQ_Envelope *ev; | 219 | struct GNUNET_MQ_Envelope *ev; |
220 | struct GNUNET_CLIENT_Connection *client; | ||
221 | 220 | ||
222 | consensus->cfg = cfg; | 221 | consensus->cfg = cfg; |
223 | consensus->new_element_cb = new_element_cb; | 222 | consensus->new_element_cb = new_element_cb; |
224 | consensus->new_element_cls = new_element_cls; | 223 | consensus->new_element_cls = new_element_cls; |
225 | consensus->session_id = *session_id; | 224 | consensus->session_id = *session_id; |
226 | client = GNUNET_CLIENT_connect ("consensus", cfg); | 225 | consensus->mq = GNUNET_CLIENT_connecT (cfg, |
227 | if (NULL == client) | 226 | "consensus", |
227 | mq_handlers, | ||
228 | &mq_error_handler, | ||
229 | consensus); | ||
230 | if (NULL == consensus->mq) | ||
228 | { | 231 | { |
229 | GNUNET_free (consensus); | 232 | GNUNET_free (consensus); |
230 | return NULL; | 233 | return NULL; |
231 | } | 234 | } |
232 | consensus->mq = GNUNET_MQ_queue_for_connection_client (client, | ||
233 | mq_handlers, | ||
234 | &mq_error_handler, | ||
235 | consensus); | ||
236 | ev = GNUNET_MQ_msg_extra (join_msg, | 235 | ev = GNUNET_MQ_msg_extra (join_msg, |
237 | (num_peers * sizeof (struct GNUNET_PeerIdentity)), | 236 | (num_peers * sizeof (struct GNUNET_PeerIdentity)), |
238 | GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_JOIN); | 237 | GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_JOIN); |
diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c index b08de8229..a288e74d2 100644 --- a/src/peerstore/peerstore_api.c +++ b/src/peerstore/peerstore_api.c | |||
@@ -807,7 +807,6 @@ reconnect (struct GNUNET_PEERSTORE_Handle *h) | |||
807 | void *icb_cls; | 807 | void *icb_cls; |
808 | struct GNUNET_PEERSTORE_StoreContext *sc; | 808 | struct GNUNET_PEERSTORE_StoreContext *sc; |
809 | struct GNUNET_MQ_Envelope *ev; | 809 | struct GNUNET_MQ_Envelope *ev; |
810 | struct GNUNET_CLIENT_Connection *client; | ||
811 | 810 | ||
812 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 811 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
813 | "Reconnecting...\n"); | 812 | "Reconnecting...\n"); |
@@ -830,13 +829,13 @@ reconnect (struct GNUNET_PEERSTORE_Handle *h) | |||
830 | GNUNET_MQ_destroy (h->mq); | 829 | GNUNET_MQ_destroy (h->mq); |
831 | h->mq = NULL; | 830 | h->mq = NULL; |
832 | } | 831 | } |
833 | client = GNUNET_CLIENT_connect ("peerstore", | 832 | h->mq = GNUNET_CLIENT_connecT (h->cfg, |
834 | h->cfg); | 833 | "peerstore", |
835 | if (NULL == client) | 834 | mq_handlers, |
835 | &handle_client_error, | ||
836 | h); | ||
837 | if (NULL == h->mq) | ||
836 | return; | 838 | return; |
837 | h->mq = GNUNET_MQ_queue_for_connection_client (client, | ||
838 | mq_handlers, | ||
839 | &handle_client_error, h); | ||
840 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 839 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
841 | "Resending pending requests after reconnect.\n"); | 840 | "Resending pending requests after reconnect.\n"); |
842 | if (NULL != h->watches) | 841 | if (NULL != h->watches) |
diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c index b52e9da51..16a0c6c54 100644 --- a/src/rps/rps_api.c +++ b/src/rps/rps_api.c | |||
@@ -221,13 +221,11 @@ reconnect (struct GNUNET_RPS_Handle *h) | |||
221 | 221 | ||
222 | if (NULL != h->mq) | 222 | if (NULL != h->mq) |
223 | GNUNET_MQ_destroy (h->mq); | 223 | GNUNET_MQ_destroy (h->mq); |
224 | conn = GNUNET_CLIENT_connect ("rps", h->cfg); | 224 | h->mq = GNUNET_CLIENT_connecT (h->cfg, |
225 | if (NULL == conn) | 225 | "rps", |
226 | return; | 226 | mq_handlers, |
227 | h->mq = GNUNET_MQ_queue_for_connection_client (conn, | 227 | &mq_error_handler, |
228 | mq_handlers, | 228 | h); |
229 | &mq_error_handler, | ||
230 | h); | ||
231 | } | 229 | } |
232 | 230 | ||
233 | 231 | ||
diff --git a/src/secretsharing/secretsharing_api.c b/src/secretsharing/secretsharing_api.c index e268fc56f..7b98a749c 100644 --- a/src/secretsharing/secretsharing_api.c +++ b/src/secretsharing/secretsharing_api.c | |||
@@ -260,10 +260,14 @@ GNUNET_SECRETSHARING_create_session (const struct GNUNET_CONFIGURATION_Handle *c | |||
260 | }; | 260 | }; |
261 | struct GNUNET_MQ_Envelope *ev; | 261 | struct GNUNET_MQ_Envelope *ev; |
262 | struct GNUNET_SECRETSHARING_CreateMessage *msg; | 262 | struct GNUNET_SECRETSHARING_CreateMessage *msg; |
263 | struct GNUNET_CLIENT_Connection *client; | ||
264 | 263 | ||
265 | client = GNUNET_CLIENT_connect ("secretsharing", cfg); | 264 | s->mq = GNUNET_CLIENT_connecT (cfg, |
266 | if (NULL == client) | 265 | "secretsharing", |
266 | client, | ||
267 | mq_handlers, | ||
268 | &handle_session_client_error, | ||
269 | s); | ||
270 | if (NULL == s->mq) | ||
267 | { | 271 | { |
268 | /* secretsharing not configured correctly */ | 272 | /* secretsharing not configured correctly */ |
269 | GNUNET_break (0); | 273 | GNUNET_break (0); |
@@ -272,12 +276,6 @@ GNUNET_SECRETSHARING_create_session (const struct GNUNET_CONFIGURATION_Handle *c | |||
272 | } | 276 | } |
273 | s->secret_ready_cb = cb; | 277 | s->secret_ready_cb = cb; |
274 | s->secret_ready_cls = cls; | 278 | s->secret_ready_cls = cls; |
275 | s->mq = GNUNET_MQ_queue_for_connection_client (client, | ||
276 | mq_handlers, | ||
277 | &handle_session_client_error, | ||
278 | s); | ||
279 | GNUNET_assert (NULL != s->mq); | ||
280 | |||
281 | ev = GNUNET_MQ_msg_extra (msg, | 279 | ev = GNUNET_MQ_msg_extra (msg, |
282 | num_peers * sizeof (struct GNUNET_PeerIdentity), | 280 | num_peers * sizeof (struct GNUNET_PeerIdentity), |
283 | GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_GENERATE); | 281 | GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_GENERATE); |
@@ -348,20 +346,19 @@ GNUNET_SECRETSHARING_decrypt (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
348 | struct GNUNET_MQ_Envelope *ev; | 346 | struct GNUNET_MQ_Envelope *ev; |
349 | struct GNUNET_SECRETSHARING_DecryptRequestMessage *msg; | 347 | struct GNUNET_SECRETSHARING_DecryptRequestMessage *msg; |
350 | size_t share_size; | 348 | size_t share_size; |
351 | struct GNUNET_CLIENT_Connection *client; | ||
352 | 349 | ||
353 | client = GNUNET_CLIENT_connect ("secretsharing", cfg); | ||
354 | if (NULL == client) | ||
355 | return NULL; | ||
356 | s->decrypt_cb = decrypt_cb; | 350 | s->decrypt_cb = decrypt_cb; |
357 | s->decrypt_cls = decrypt_cb_cls; | 351 | s->decrypt_cls = decrypt_cb_cls; |
358 | 352 | s->mq = GNUNET_CLIENT_connecT (cfg, | |
359 | s->mq = GNUNET_MQ_queue_for_connection_client (client, | 353 | "secretsharing", |
360 | mq_handlers, | 354 | mq_handlers, |
361 | &handle_decrypt_client_error, | 355 | &handle_decrypt_client_error, |
362 | s); | 356 | s); |
363 | GNUNET_assert (NULL != s->mq); | 357 | if (NULL == s->mq) |
364 | 358 | { | |
359 | GNUNET_free (s); | ||
360 | return NULL; | ||
361 | } | ||
365 | GNUNET_assert (GNUNET_OK == | 362 | GNUNET_assert (GNUNET_OK == |
366 | GNUNET_SECRETSHARING_share_write (share, NULL, 0, | 363 | GNUNET_SECRETSHARING_share_write (share, NULL, 0, |
367 | &share_size)); | 364 | &share_size)); |
diff --git a/src/set/set_api.c b/src/set/set_api.c index 0b99c7bf6..af4907dea 100644 --- a/src/set/set_api.c +++ b/src/set/set_api.c | |||
@@ -903,21 +903,21 @@ listen_connect (void *cls) | |||
903 | }; | 903 | }; |
904 | struct GNUNET_MQ_Envelope *mqm; | 904 | struct GNUNET_MQ_Envelope *mqm; |
905 | struct GNUNET_SET_ListenMessage *msg; | 905 | struct GNUNET_SET_ListenMessage *msg; |
906 | struct GNUNET_CLIENT_Connection *client; | ||
907 | 906 | ||
908 | lh->reconnect_task = NULL; | 907 | lh->reconnect_task = NULL; |
909 | GNUNET_assert (NULL == lh->mq); | 908 | GNUNET_assert (NULL == lh->mq); |
910 | client = GNUNET_CLIENT_connect ("set", lh->cfg); | 909 | lh->mq = GNUNET_CLIENT_connecT (lh->cfg, |
911 | if (NULL == client) | 910 | "set", |
911 | mq_handlers, | ||
912 | &handle_client_listener_error, | ||
913 | lh); | ||
914 | if (NULL == lh->mq) | ||
912 | return; | 915 | return; |
913 | lh->mq = GNUNET_MQ_queue_for_connection_client (client, | ||
914 | mq_handlers, | ||
915 | &handle_client_listener_error, | ||
916 | lh); | ||
917 | mqm = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SET_LISTEN); | 916 | mqm = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SET_LISTEN); |
918 | msg->operation = htonl (lh->operation); | 917 | msg->operation = htonl (lh->operation); |
919 | msg->app_id = lh->app_id; | 918 | msg->app_id = lh->app_id; |
920 | GNUNET_MQ_send (lh->mq, mqm); | 919 | GNUNET_MQ_send (lh->mq, |
920 | mqm); | ||
921 | } | 921 | } |
922 | 922 | ||
923 | 923 | ||
diff --git a/src/util/test_mq_client.c b/src/util/test_mq_client.c index 27458ec0a..f436d1a4c 100644 --- a/src/util/test_mq_client.c +++ b/src/util/test_mq_client.c | |||
@@ -113,15 +113,13 @@ send_trap_cb (void *cls) | |||
113 | static void | 113 | static void |
114 | test_mq () | 114 | test_mq () |
115 | { | 115 | { |
116 | struct GNUNET_CLIENT_Connection *client; | ||
117 | struct GNUNET_MQ_Handle *mq; | 116 | struct GNUNET_MQ_Handle *mq; |
118 | struct GNUNET_MQ_Envelope *mqm; | 117 | struct GNUNET_MQ_Envelope *mqm; |
119 | 118 | ||
120 | client = GNUNET_CLIENT_connect ("test", cfg); | ||
121 | GNUNET_assert (client != NULL); | ||
122 | |||
123 | /* FIXME: test handling responses */ | 119 | /* FIXME: test handling responses */ |
124 | mq = GNUNET_MQ_queue_for_connection_client (client, NULL, NULL, NULL); | 120 | mq = GNUNET_CLIENT_connecT (cfg, |
121 | "test", | ||
122 | NULL, NULL, NULL); | ||
125 | 123 | ||
126 | mqm = GNUNET_MQ_msg_header (MY_TYPE); | 124 | mqm = GNUNET_MQ_msg_header (MY_TYPE); |
127 | GNUNET_MQ_send (mq, mqm); | 125 | GNUNET_MQ_send (mq, mqm); |