diff options
Diffstat (limited to 'src/gns/gns_api.c')
-rw-r--r-- | src/gns/gns_api.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index 7b97c6df8..75c2f9530 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c | |||
@@ -46,32 +46,32 @@ struct GNUNET_GNS_LookupRequest | |||
46 | * DLL | 46 | * DLL |
47 | */ | 47 | */ |
48 | struct GNUNET_GNS_LookupRequest *next; | 48 | struct GNUNET_GNS_LookupRequest *next; |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * DLL | 51 | * DLL |
52 | */ | 52 | */ |
53 | struct GNUNET_GNS_LookupRequest *prev; | 53 | struct GNUNET_GNS_LookupRequest *prev; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * handle to gns | 56 | * handle to gns |
57 | */ | 57 | */ |
58 | struct GNUNET_GNS_Handle *gns_handle; | 58 | struct GNUNET_GNS_Handle *gns_handle; |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * processor to call on lookup result | 61 | * processor to call on lookup result |
62 | */ | 62 | */ |
63 | GNUNET_GNS_LookupResultProcessor lookup_proc; | 63 | GNUNET_GNS_LookupResultProcessor lookup_proc; |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * processor closure | 66 | * processor closure |
67 | */ | 67 | */ |
68 | void *proc_cls; | 68 | void *proc_cls; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * request id | 71 | * request id |
72 | */ | 72 | */ |
73 | uint32_t r_id; | 73 | uint32_t r_id; |
74 | 74 | ||
75 | }; | 75 | }; |
76 | 76 | ||
77 | 77 | ||
@@ -130,7 +130,7 @@ struct GNUNET_GNS_Handle | |||
130 | * Currently pending transmission request (or NULL). | 130 | * Currently pending transmission request (or NULL). |
131 | */ | 131 | */ |
132 | struct GNUNET_CLIENT_TransmitHandle *th; | 132 | struct GNUNET_CLIENT_TransmitHandle *th; |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * Head of linked list of shorten messages we would like to transmit. | 135 | * Head of linked list of shorten messages we would like to transmit. |
136 | */ | 136 | */ |
@@ -140,7 +140,7 @@ struct GNUNET_GNS_Handle | |||
140 | * Tail of linked list of shorten messages we would like to transmit. | 140 | * Tail of linked list of shorten messages we would like to transmit. |
141 | */ | 141 | */ |
142 | struct PendingMessage *pending_tail; | 142 | struct PendingMessage *pending_tail; |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * Head of linked list of lookup messages we would like to transmit. | 145 | * Head of linked list of lookup messages we would like to transmit. |
146 | */ | 146 | */ |
@@ -155,7 +155,7 @@ struct GNUNET_GNS_Handle | |||
155 | * Reconnect task | 155 | * Reconnect task |
156 | */ | 156 | */ |
157 | GNUNET_SCHEDULER_TaskIdentifier reconnect_task; | 157 | GNUNET_SCHEDULER_TaskIdentifier reconnect_task; |
158 | 158 | ||
159 | /** | 159 | /** |
160 | * How long do we wait until we try to reconnect? | 160 | * How long do we wait until we try to reconnect? |
161 | */ | 161 | */ |
@@ -165,7 +165,7 @@ struct GNUNET_GNS_Handle | |||
165 | * Request Id generator. Incremented by one for each request. | 165 | * Request Id generator. Incremented by one for each request. |
166 | */ | 166 | */ |
167 | uint32_t r_id_gen; | 167 | uint32_t r_id_gen; |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * Did we start our receive loop yet? | 170 | * Did we start our receive loop yet? |
171 | */ | 171 | */ |
@@ -237,7 +237,7 @@ force_reconnect (struct GNUNET_GNS_Handle *handle) | |||
237 | p->transmitted = GNUNET_NO; | 237 | p->transmitted = GNUNET_NO; |
238 | GNUNET_CONTAINER_DLL_insert (handle->pending_head, | 238 | GNUNET_CONTAINER_DLL_insert (handle->pending_head, |
239 | handle->pending_tail, | 239 | handle->pending_tail, |
240 | p); | 240 | p); |
241 | } | 241 | } |
242 | handle->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff); | 242 | handle->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff); |
243 | handle->reconnect_task = GNUNET_SCHEDULER_add_delayed (handle->reconnect_backoff, | 243 | handle->reconnect_task = GNUNET_SCHEDULER_add_delayed (handle->reconnect_backoff, |
@@ -279,17 +279,17 @@ process_pending_messages (struct GNUNET_GNS_Handle *handle) | |||
279 | struct PendingMessage *p = handle->pending_head; | 279 | struct PendingMessage *p = handle->pending_head; |
280 | 280 | ||
281 | if (NULL == handle->client) | 281 | if (NULL == handle->client) |
282 | return; /* wait for reconnect */ | 282 | return; /* wait for reconnect */ |
283 | if (NULL != handle->th) | 283 | if (NULL != handle->th) |
284 | return; /* transmission request already pending */ | 284 | return; /* transmission request already pending */ |
285 | 285 | ||
286 | while ((NULL != p) && (p->transmitted == GNUNET_YES)) | 286 | while ((NULL != p) && (p->transmitted == GNUNET_YES)) |
287 | p = p->next; | 287 | p = p->next; |
288 | if (NULL == p) | 288 | if (NULL == p) |
289 | return; /* no messages pending */ | 289 | return; /* no messages pending */ |
290 | 290 | ||
291 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 291 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
292 | "Trying to transmit %u bytes\n", | 292 | "Trying to transmit %u bytes\n", |
293 | (unsigned int) p->size); | 293 | (unsigned int) p->size); |
294 | handle->th = | 294 | handle->th = |
295 | GNUNET_CLIENT_notify_transmit_ready (handle->client, | 295 | GNUNET_CLIENT_notify_transmit_ready (handle->client, |
@@ -324,7 +324,7 @@ transmit_pending (void *cls, size_t size, void *buf) | |||
324 | "Transmission to GNS service failed!\n"); | 324 | "Transmission to GNS service failed!\n"); |
325 | force_reconnect (handle); | 325 | force_reconnect (handle); |
326 | return 0; | 326 | return 0; |
327 | } | 327 | } |
328 | if (NULL == (p = handle->pending_head)) | 328 | if (NULL == (p = handle->pending_head)) |
329 | return 0; | 329 | return 0; |
330 | 330 | ||
@@ -388,7 +388,7 @@ process_lookup_reply (struct GNUNET_GNS_LookupRequest *qe, | |||
388 | qe->lookup_proc (qe->proc_cls, 0, NULL); | 388 | qe->lookup_proc (qe->proc_cls, 0, NULL); |
389 | } | 389 | } |
390 | else | 390 | else |
391 | { | 391 | { |
392 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 392 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
393 | "Received lookup reply from GNS service (%u records)\n", | 393 | "Received lookup reply from GNS service (%u records)\n", |
394 | (unsigned int) rd_count); | 394 | (unsigned int) rd_count); |
@@ -412,7 +412,7 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg) | |||
412 | struct GNUNET_GNS_LookupRequest *lr; | 412 | struct GNUNET_GNS_LookupRequest *lr; |
413 | const struct GNUNET_GNS_ClientLookupResultMessage *lookup_msg; | 413 | const struct GNUNET_GNS_ClientLookupResultMessage *lookup_msg; |
414 | uint32_t r_id; | 414 | uint32_t r_id; |
415 | 415 | ||
416 | if (NULL == msg) | 416 | if (NULL == msg) |
417 | { | 417 | { |
418 | force_reconnect (handle); | 418 | force_reconnect (handle); |
@@ -430,11 +430,11 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg) | |||
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | lookup_msg = (const struct GNUNET_GNS_ClientLookupResultMessage *) msg; | 432 | lookup_msg = (const struct GNUNET_GNS_ClientLookupResultMessage *) msg; |
433 | r_id = ntohl (lookup_msg->id); | 433 | r_id = ntohl (lookup_msg->id); |
434 | for (lr = handle->lookup_head; NULL != lr; lr = lr->next) | 434 | for (lr = handle->lookup_head; NULL != lr; lr = lr->next) |
435 | if (lr->r_id == r_id) | 435 | if (lr->r_id == r_id) |
436 | { | 436 | { |
437 | process_lookup_reply(lr, lookup_msg); | 437 | process_lookup_reply(lr, lookup_msg); |
438 | break; | 438 | break; |
439 | } | 439 | } |
440 | break; | 440 | break; |
@@ -499,7 +499,7 @@ GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr) | |||
499 | { | 499 | { |
500 | struct PendingMessage *p = (struct PendingMessage*) &lr[1]; | 500 | struct PendingMessage *p = (struct PendingMessage*) &lr[1]; |
501 | 501 | ||
502 | GNUNET_assert (NULL != lr->gns_handle); | 502 | GNUNET_assert (NULL != lr->gns_handle); |
503 | if (GNUNET_NO == p->transmitted) | 503 | if (GNUNET_NO == p->transmitted) |
504 | GNUNET_CONTAINER_DLL_remove (lr->gns_handle->pending_head, | 504 | GNUNET_CONTAINER_DLL_remove (lr->gns_handle->pending_head, |
505 | lr->gns_handle->pending_tail, | 505 | lr->gns_handle->pending_tail, |
@@ -544,9 +544,9 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, | |||
544 | { | 544 | { |
545 | GNUNET_break (0); | 545 | GNUNET_break (0); |
546 | return NULL; | 546 | return NULL; |
547 | } | 547 | } |
548 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 548 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
549 | "Trying to lookup `%s' in GNS\n", | 549 | "Trying to lookup `%s' in GNS\n", |
550 | name); | 550 | name); |
551 | msize = sizeof (struct GNUNET_GNS_ClientLookupMessage) | 551 | msize = sizeof (struct GNUNET_GNS_ClientLookupMessage) |
552 | + strlen (name) + 1; | 552 | + strlen (name) + 1; |