diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-10 13:48:16 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-10 13:48:16 +0000 |
commit | bc48ad971b2d681e2e77fdd0b5bd136278911857 (patch) | |
tree | 7f96dbc93566144d7a131248594e076f828bd44c /src/dv/dv_api.c | |
parent | 215714314289a4753be984cccb68fb8fc97ccbd1 (diff) | |
download | gnunet-bc48ad971b2d681e2e77fdd0b5bd136278911857.tar.gz gnunet-bc48ad971b2d681e2e77fdd0b5bd136278911857.zip |
use LOG macro in dv_api.c
Diffstat (limited to 'src/dv/dv_api.c')
-rw-r--r-- | src/dv/dv_api.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/src/dv/dv_api.c b/src/dv/dv_api.c index d4c07ecdc..876282ea7 100644 --- a/src/dv/dv_api.c +++ b/src/dv/dv_api.c | |||
@@ -38,6 +38,8 @@ | |||
38 | #include "dv.h" | 38 | #include "dv.h" |
39 | #include "gnunet_transport_plugin.h" | 39 | #include "gnunet_transport_plugin.h" |
40 | 40 | ||
41 | #define LOG(kind,...) GNUNET_log_from (kind, "dv-api",__VA_ARGS__) | ||
42 | |||
41 | /** | 43 | /** |
42 | * Store ready to send messages | 44 | * Store ready to send messages |
43 | */ | 45 | */ |
@@ -174,8 +176,7 @@ try_connect (struct GNUNET_DV_Handle *ret) | |||
174 | if (ret->client != NULL) | 176 | if (ret->client != NULL) |
175 | return GNUNET_YES; | 177 | return GNUNET_YES; |
176 | #if DEBUG_DV_MESSAGES | 178 | #if DEBUG_DV_MESSAGES |
177 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 179 | LOG (GNUNET_ERROR_TYPE_DEBUG, _("Failed to connect to the dv service!\n")); |
178 | _("Failed to connect to the dv service!\n")); | ||
179 | #endif | 180 | #endif |
180 | return GNUNET_NO; | 181 | return GNUNET_NO; |
181 | } | 182 | } |
@@ -219,16 +220,15 @@ transmit_pending (void *cls, size_t size, void *buf) | |||
219 | 220 | ||
220 | #if DEBUG_DV | 221 | #if DEBUG_DV |
221 | if (handle->current != NULL) | 222 | if (handle->current != NULL) |
222 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 223 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
223 | "DV API: Transmit pending called with message type %d\n", | 224 | "DV API: Transmit pending called with message type %d\n", |
224 | ntohs (handle->current->msg->header.type)); | 225 | ntohs (handle->current->msg->header.type)); |
225 | #endif | 226 | #endif |
226 | 227 | ||
227 | if (buf == NULL) | 228 | if (buf == NULL) |
228 | { | 229 | { |
229 | #if DEBUG_DV | 230 | #if DEBUG_DV |
230 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 231 | LOG (GNUNET_ERROR_TYPE_DEBUG, "DV API: Transmit pending FAILED!\n\n\n"); |
231 | "DV API: Transmit pending FAILED!\n\n\n"); | ||
232 | #endif | 232 | #endif |
233 | finish (handle, GNUNET_SYSERR); | 233 | finish (handle, GNUNET_SYSERR); |
234 | return 0; | 234 | return 0; |
@@ -244,8 +244,8 @@ transmit_pending (void *cls, size_t size, void *buf) | |||
244 | { | 244 | { |
245 | memcpy (buf, handle->current->msg, tsize); | 245 | memcpy (buf, handle->current->msg, tsize); |
246 | #if DEBUG_DV | 246 | #if DEBUG_DV |
247 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 247 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
248 | "DV API: Copied %d bytes into buffer!\n\n\n", tsize); | 248 | "DV API: Copied %d bytes into buffer!\n\n\n", tsize); |
249 | #endif | 249 | #endif |
250 | finish (handle, GNUNET_OK); | 250 | finish (handle, GNUNET_OK); |
251 | return tsize; | 251 | return tsize; |
@@ -292,8 +292,8 @@ process_pending_message (struct GNUNET_DV_Handle *handle) | |||
292 | handle))) | 292 | handle))) |
293 | { | 293 | { |
294 | #if DEBUG_DV | 294 | #if DEBUG_DV |
295 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 295 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
296 | "Failed to transmit request to dv service.\n"); | 296 | "Failed to transmit request to dv service.\n"); |
297 | #endif | 297 | #endif |
298 | finish (handle, GNUNET_SYSERR); | 298 | finish (handle, GNUNET_SYSERR); |
299 | } | 299 | } |
@@ -357,7 +357,7 @@ handle_message_receipt (void *cls, const struct GNUNET_MessageHeader *msg) | |||
357 | if (msg == NULL) | 357 | if (msg == NULL) |
358 | { | 358 | { |
359 | #if DEBUG_DV_MESSAGES | 359 | #if DEBUG_DV_MESSAGES |
360 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DV_API receive: connection closed\n"); | 360 | LOG (GNUNET_ERROR_TYPE_DEBUG, "DV_API receive: connection closed\n"); |
361 | #endif | 361 | #endif |
362 | return; /* Connection closed? */ | 362 | return; /* Connection closed? */ |
363 | } | 363 | } |
@@ -385,15 +385,15 @@ handle_message_receipt (void *cls, const struct GNUNET_MessageHeader *msg) | |||
385 | memcpy (packed_msg, &packed_msg_start[sender_address_len], packed_msg_len); | 385 | memcpy (packed_msg, &packed_msg_start[sender_address_len], packed_msg_len); |
386 | 386 | ||
387 | #if DEBUG_DV_MESSAGES | 387 | #if DEBUG_DV_MESSAGES |
388 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 388 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
389 | "DV_API receive: packed message type: %d or %d\n", | 389 | "DV_API receive: packed message type: %d or %d\n", |
390 | ntohs (((struct GNUNET_MessageHeader *) packed_msg)->type), | 390 | ntohs (((struct GNUNET_MessageHeader *) packed_msg)->type), |
391 | ((struct GNUNET_MessageHeader *) packed_msg)->type); | 391 | ((struct GNUNET_MessageHeader *) packed_msg)->type); |
392 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 392 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
393 | "DV_API receive: message sender reported as %s\n", | 393 | "DV_API receive: message sender reported as %s\n", |
394 | GNUNET_i2s (&received_msg->sender)); | 394 | GNUNET_i2s (&received_msg->sender)); |
395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "DV_API receive: distance is %u\n", | 395 | LOG (GNUNET_ERROR_TYPE_DEBUG, "DV_API receive: distance is %u\n", |
396 | ntohl (received_msg->distance)); | 396 | ntohl (received_msg->distance)); |
397 | #endif | 397 | #endif |
398 | 398 | ||
399 | handle->receive_handler (handle->receive_cls, &received_msg->sender, | 399 | handle->receive_handler (handle->receive_cls, &received_msg->sender, |
@@ -513,8 +513,7 @@ transmit_start (void *cls, size_t size, void *buf) | |||
513 | size_t tsize; | 513 | size_t tsize; |
514 | 514 | ||
515 | #if DEBUG_DV | 515 | #if DEBUG_DV |
516 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 516 | LOG (GNUNET_ERROR_TYPE_DEBUG, "DV API: sending start request to service\n"); |
517 | "DV API: sending start request to service\n"); | ||
518 | #endif | 517 | #endif |
519 | if (buf == NULL) | 518 | if (buf == NULL) |
520 | { | 519 | { |