diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-09-18 13:29:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-09-18 13:29:39 +0000 |
commit | a0b1e4ae909d99bacac9ecaa52449d6c940d5947 (patch) | |
tree | bb538c35d95c456f46d8008cbb4ad437ebb57f0b /src/gns/gns_api.c | |
parent | dd663a8d291aa5cd0a1235856ba60b71c4c3d344 (diff) | |
download | gnunet-a0b1e4ae909d99bacac9ecaa52449d6c940d5947.tar.gz gnunet-a0b1e4ae909d99bacac9ecaa52449d6c940d5947.zip |
-code review, breaking build a bit
Diffstat (limited to 'src/gns/gns_api.c')
-rw-r--r-- | src/gns/gns_api.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index ddc871409..670b036a5 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c | |||
@@ -409,21 +409,27 @@ process_shorten_reply (struct GNUNET_GNS_ShortenRequest *qe, | |||
409 | 409 | ||
410 | GNUNET_CONTAINER_DLL_remove (h->shorten_head, h->shorten_tail, qe); | 410 | GNUNET_CONTAINER_DLL_remove (h->shorten_head, h->shorten_tail, qe); |
411 | mlen = ntohs (msg->header.size); | 411 | mlen = ntohs (msg->header.size); |
412 | short_name = (const char *) &msg[1]; | 412 | if (ntohs (msg->header.size) == sizeof (struct GNUNET_GNS_ClientShortenResultMessage)) |
413 | 413 | { | |
414 | if ( (ntohs (msg->header.size) <= sizeof (struct GNUNET_GNS_ClientShortenResultMessage)) || | 414 | /* service reports resolution failed */ |
415 | ('\0' != short_name[mlen - sizeof (struct GNUNET_GNS_ClientShortenResultMessage) - 1]) ) | 415 | short_name = NULL; |
416 | { | 416 | } |
417 | GNUNET_break (0); | 417 | else |
418 | // FIXME: reconnect and queue management logic is broken... | 418 | { |
419 | qe->shorten_proc (qe->proc_cls, NULL); | 419 | short_name = (const char *) &msg[1]; |
420 | GNUNET_free (qe); | 420 | if ('\0' != short_name[mlen - sizeof (struct GNUNET_GNS_ClientShortenResultMessage) - 1]) |
421 | force_reconnect (h); | 421 | { |
422 | return; | 422 | GNUNET_break (0); |
423 | } | 423 | // FIXME: reconnect and queue management logic is broken... |
424 | qe->shorten_proc (qe->proc_cls, NULL); | ||
425 | GNUNET_free (qe); | ||
426 | force_reconnect (h); | ||
427 | return; | ||
428 | } | ||
429 | } | ||
424 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 430 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
425 | "Received shortened reply `%s' from GNS service\n", | 431 | "Received shortened reply `%s' from GNS service\n", |
426 | short_name); | 432 | short_name); |
427 | qe->shorten_proc (qe->proc_cls, short_name); | 433 | qe->shorten_proc (qe->proc_cls, short_name); |
428 | GNUNET_free (qe); | 434 | GNUNET_free (qe); |
429 | } | 435 | } |