diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-15 15:01:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-15 15:01:39 +0000 |
commit | 8094e23bf7e13b1c203ba8b85e5edcbfdf5ff650 (patch) | |
tree | 424d79f91128aa2428c32d8c6efbd9e926bf37b6 /src/ats/ats_api_performance.c | |
parent | 482d35a0c3148bcc69929c5778038db00d0839b9 (diff) | |
download | gnunet-8094e23bf7e13b1c203ba8b85e5edcbfdf5ff650.tar.gz gnunet-8094e23bf7e13b1c203ba8b85e5edcbfdf5ff650.zip |
-doxygen, indentation
Diffstat (limited to 'src/ats/ats_api_performance.c')
-rw-r--r-- | src/ats/ats_api_performance.c | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c index ab242a0e9..840e302b0 100644 --- a/src/ats/ats_api_performance.c +++ b/src/ats/ats_api_performance.c | |||
@@ -481,9 +481,9 @@ process_ar_message (struct GNUNET_ATS_PerformanceHandle *ph, | |||
481 | GNUNET_break(0); | 481 | GNUNET_break(0); |
482 | return GNUNET_SYSERR; | 482 | return GNUNET_SYSERR; |
483 | } | 483 | } |
484 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 484 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
485 | _("Received %s message\n"), | 485 | _("Received %s message\n"), |
486 | "ATS_ADDRESSLIST_RESPONSE"); | 486 | "ATS_ADDRESSLIST_RESPONSE"); |
487 | 487 | ||
488 | pi = (const struct PeerInformationMessage *) msg; | 488 | pi = (const struct PeerInformationMessage *) msg; |
489 | id = ntohl (pi->id); | 489 | id = ntohl (pi->id); |
@@ -520,20 +520,27 @@ process_ar_message (struct GNUNET_ATS_PerformanceHandle *ph, | |||
520 | } | 520 | } |
521 | 521 | ||
522 | memset (&allzeros, '\0', sizeof(allzeros)); | 522 | memset (&allzeros, '\0', sizeof(allzeros)); |
523 | if ((0 == memcmp (&allzeros, &pi->peer, sizeof(allzeros))) | 523 | if ( (0 == memcmp (&allzeros, &pi->peer, sizeof(allzeros))) && |
524 | && (0 == plugin_name_length) && (0 == plugin_address_length) | 524 | (0 == plugin_name_length) && |
525 | && (0 == ats_count)) | 525 | (0 == plugin_address_length) && |
526 | (0 == ats_count) ) | ||
526 | { | 527 | { |
527 | /* Done */ | 528 | /* Done */ |
528 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, _("Received last message for %s \n"), | 529 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
529 | "ATS_ADDRESSLIST_RESPONSE"); | 530 | _("Received last message for %s \n"), |
531 | "ATS_ADDRESSLIST_RESPONSE"); | ||
530 | bandwidth_zero.value__ = htonl (0); | 532 | bandwidth_zero.value__ = htonl (0); |
533 | GNUNET_CONTAINER_DLL_remove (ph->addresslist_head, | ||
534 | ph->addresslist_tail, | ||
535 | alh); | ||
531 | if (NULL != alh->cb) | 536 | if (NULL != alh->cb) |
532 | alh->cb (ph->addr_info_cb_cls, NULL, GNUNET_NO, bandwidth_zero, | 537 | alh->cb (ph->addr_info_cb_cls, |
533 | bandwidth_zero, NULL, 0); | 538 | NULL, |
534 | GNUNET_CONTAINER_DLL_remove(ph->addresslist_head, ph->addresslist_tail, | 539 | GNUNET_NO, |
535 | alh); | 540 | bandwidth_zero, |
536 | GNUNET_free(alh); | 541 | bandwidth_zero, |
542 | NULL, 0); | ||
543 | GNUNET_free (alh); | ||
537 | return GNUNET_OK; | 544 | return GNUNET_OK; |
538 | } | 545 | } |
539 | 546 | ||
@@ -797,10 +804,8 @@ GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *hand | |||
797 | struct PendingMessage *p; | 804 | struct PendingMessage *p; |
798 | struct AddressListRequestMessage *m; | 805 | struct AddressListRequestMessage *m; |
799 | 806 | ||
800 | GNUNET_assert(NULL != handle); | ||
801 | if (NULL == infocb) | 807 | if (NULL == infocb) |
802 | return NULL ; | 808 | return NULL; |
803 | |||
804 | alh = GNUNET_new (struct GNUNET_ATS_AddressListHandle); | 809 | alh = GNUNET_new (struct GNUNET_ATS_AddressListHandle); |
805 | alh->id = handle->id; | 810 | alh->id = handle->id; |
806 | handle->id++; | 811 | handle->id++; |
@@ -809,19 +814,21 @@ GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *hand | |||
809 | alh->ph = handle; | 814 | alh->ph = handle; |
810 | alh->all_addresses = all; | 815 | alh->all_addresses = all; |
811 | if (NULL == peer) | 816 | if (NULL == peer) |
817 | { | ||
812 | alh->all_peers = GNUNET_YES; | 818 | alh->all_peers = GNUNET_YES; |
819 | } | ||
813 | else | 820 | else |
814 | { | 821 | { |
815 | alh->all_peers = GNUNET_NO; | 822 | alh->all_peers = GNUNET_NO; |
816 | alh->peer = (*peer); | 823 | alh->peer = (*peer); |
817 | } | 824 | } |
818 | 825 | GNUNET_CONTAINER_DLL_insert (handle->addresslist_head, | |
819 | GNUNET_CONTAINER_DLL_insert(handle->addresslist_head, | 826 | handle->addresslist_tail, |
820 | handle->addresslist_tail, alh); | 827 | alh); |
821 | 828 | ||
822 | p = GNUNET_malloc (sizeof (struct PendingMessage) + | 829 | p = GNUNET_malloc (sizeof (struct PendingMessage) + |
823 | sizeof (struct AddressListRequestMessage)); | 830 | sizeof (struct AddressListRequestMessage)); |
824 | p->size = sizeof(struct AddressListRequestMessage); | 831 | p->size = sizeof (struct AddressListRequestMessage); |
825 | m = (struct AddressListRequestMessage *) &p[1]; | 832 | m = (struct AddressListRequestMessage *) &p[1]; |
826 | m->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST); | 833 | m->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST); |
827 | m->header.size = htons (sizeof(struct AddressListRequestMessage)); | 834 | m->header.size = htons (sizeof(struct AddressListRequestMessage)); |
@@ -829,14 +836,9 @@ GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *hand | |||
829 | m->id = htonl (alh->id); | 836 | m->id = htonl (alh->id); |
830 | if (NULL != peer) | 837 | if (NULL != peer) |
831 | m->peer = *peer; | 838 | m->peer = *peer; |
832 | else | ||
833 | { | ||
834 | memset (&m->peer, '\0', sizeof(struct GNUNET_PeerIdentity)); | ||
835 | } | ||
836 | GNUNET_CONTAINER_DLL_insert_tail(handle->pending_head, | 839 | GNUNET_CONTAINER_DLL_insert_tail(handle->pending_head, |
837 | handle->pending_tail, | 840 | handle->pending_tail, |
838 | p); | 841 | p); |
839 | |||
840 | do_transmit (handle); | 842 | do_transmit (handle); |
841 | 843 | ||
842 | return alh; | 844 | return alh; |
@@ -846,7 +848,7 @@ GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle *hand | |||
846 | /** | 848 | /** |
847 | * Cancel a pending address listing operation | 849 | * Cancel a pending address listing operation |
848 | * | 850 | * |
849 | * @param handle the GNUNET_ATS_AddressListHandle handle to cancel | 851 | * @param handle the handle of the request to cancel |
850 | */ | 852 | */ |
851 | void | 853 | void |
852 | GNUNET_ATS_performance_list_addresses_cancel (struct GNUNET_ATS_AddressListHandle *handle) | 854 | GNUNET_ATS_performance_list_addresses_cancel (struct GNUNET_ATS_AddressListHandle *handle) |
@@ -860,7 +862,7 @@ GNUNET_ATS_performance_list_addresses_cancel (struct GNUNET_ATS_AddressListHandl | |||
860 | 862 | ||
861 | 863 | ||
862 | /** | 864 | /** |
863 | * Convert a GNUNET_ATS_PreferenceType to a string | 865 | * Convert a `enum GNUNET_ATS_PreferenceType` to a string |
864 | * | 866 | * |
865 | * @param type the preference type | 867 | * @param type the preference type |
866 | * @return a string or NULL if invalid | 868 | * @return a string or NULL if invalid |
@@ -871,7 +873,7 @@ GNUNET_ATS_print_preference_type (uint32_t type) | |||
871 | char *prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceTypeString; | 873 | char *prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceTypeString; |
872 | if (type < GNUNET_ATS_PreferenceCount) | 874 | if (type < GNUNET_ATS_PreferenceCount) |
873 | return prefs[type]; | 875 | return prefs[type]; |
874 | return NULL ; | 876 | return NULL; |
875 | } | 877 | } |
876 | 878 | ||
877 | 879 | ||
@@ -988,12 +990,10 @@ GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph, | |||
988 | case GNUNET_ATS_PREFERENCE_BANDWIDTH: | 990 | case GNUNET_ATS_PREFERENCE_BANDWIDTH: |
989 | count++; | 991 | count++; |
990 | (void) va_arg (ap, double); | 992 | (void) va_arg (ap, double); |
991 | |||
992 | break; | 993 | break; |
993 | case GNUNET_ATS_PREFERENCE_LATENCY: | 994 | case GNUNET_ATS_PREFERENCE_LATENCY: |
994 | count++; | 995 | count++; |
995 | (void) va_arg (ap, double); | 996 | (void) va_arg (ap, double); |
996 | |||
997 | break; | 997 | break; |
998 | default: | 998 | default: |
999 | GNUNET_assert(0); | 999 | GNUNET_assert(0); |
@@ -1035,7 +1035,9 @@ GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph, | |||
1035 | } | 1035 | } |
1036 | } | 1036 | } |
1037 | va_end(ap); | 1037 | va_end(ap); |
1038 | GNUNET_CONTAINER_DLL_insert_tail(ph->pending_head, ph->pending_tail, p); | 1038 | GNUNET_CONTAINER_DLL_insert_tail (ph->pending_head, |
1039 | ph->pending_tail, | ||
1040 | p); | ||
1039 | do_transmit (ph); | 1041 | do_transmit (ph); |
1040 | } | 1042 | } |
1041 | 1043 | ||