aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-07-05 17:22:58 +0000
committerChristian Grothoff <christian@grothoff.org>2012-07-05 17:22:58 +0000
commit75d185ae2f305e7f751c17ce2a96e9c2cc6b3464 (patch)
tree6301796830150a6225da3acf8eddb3a908e9c8b3 /src/fs
parent86be3237abd7ff9bf06f1911802e8a38fb985650 (diff)
downloadgnunet-75d185ae2f305e7f751c17ce2a96e9c2cc6b3464.tar.gz
gnunet-75d185ae2f305e7f751c17ce2a96e9c2cc6b3464.zip
-cleanup
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/gnunet-service-fs_cp.c48
-rw-r--r--src/fs/gnunet-service-fs_pe.c5
2 files changed, 28 insertions, 25 deletions
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 8c6bf0b06..359ae9d19 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -452,7 +452,7 @@ schedule_transmission (struct GSF_PeerTransmitHandle *pth)
452 &ats_reserve_callback, cp); 452 &ats_reserve_callback, cp);
453 return; 453 return;
454 } 454 }
455 GNUNET_assert (cp->cth == NULL); 455 GNUNET_assert (NULL == cp->cth);
456 cp->cth_in_progress++; 456 cp->cth_in_progress++;
457 cp->cth = 457 cp->cth =
458 GNUNET_CORE_notify_transmit_ready (GSF_core, GNUNET_YES, pth->priority, 458 GNUNET_CORE_notify_transmit_ready (GSF_core, GNUNET_YES, pth->priority,
@@ -488,7 +488,7 @@ peer_transmit_ready_cb (void *cls, size_t size, void *buf)
488 schedule_transmission (pth); 488 schedule_transmission (pth);
489 return 0; 489 return 0;
490 } 490 }
491 if (pth->timeout_task != GNUNET_SCHEDULER_NO_TASK) 491 if (GNUNET_SCHEDULER_NO_TASK != pth->timeout_task)
492 { 492 {
493 GNUNET_SCHEDULER_cancel (pth->timeout_task); 493 GNUNET_SCHEDULER_cancel (pth->timeout_task);
494 pth->timeout_task = GNUNET_SCHEDULER_NO_TASK; 494 pth->timeout_task = GNUNET_SCHEDULER_NO_TASK;
@@ -610,7 +610,7 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer,
610 GNUNET_ATS_reserve_bandwidth (ats, peer, DBLOCK_SIZE, 610 GNUNET_ATS_reserve_bandwidth (ats, peer, DBLOCK_SIZE,
611 &ats_reserve_callback, cp); 611 &ats_reserve_callback, cp);
612 fn = get_respect_filename (peer); 612 fn = get_respect_filename (peer);
613 if ((GNUNET_DISK_file_test (fn) == GNUNET_YES) && 613 if ((GNUNET_YES == GNUNET_DISK_file_test (fn)) &&
614 (sizeof (respect) == GNUNET_DISK_fn_read (fn, &respect, sizeof (respect)))) 614 (sizeof (respect) == GNUNET_DISK_fn_read (fn, &respect, sizeof (respect))))
615 cp->disk_respect = cp->ppd.respect = ntohl (respect); 615 cp->disk_respect = cp->ppd.respect = ntohl (respect);
616 GNUNET_free (fn); 616 GNUNET_free (fn);
@@ -694,7 +694,7 @@ GSF_handle_p2p_migration_stop_ (void *cls,
694 694
695 msm = (const struct MigrationStopMessage *) message; 695 msm = (const struct MigrationStopMessage *) message;
696 cp = GSF_peer_get_ (other); 696 cp = GSF_peer_get_ (other);
697 if (cp == NULL) 697 if (NULL == cp)
698 { 698 {
699 GNUNET_break (0); 699 GNUNET_break (0);
700 return GNUNET_OK; 700 return GNUNET_OK;
@@ -707,7 +707,7 @@ GSF_handle_p2p_migration_stop_ (void *cls,
707 _("Migration of content to peer `%s' blocked for %llu ms\n"), 707 _("Migration of content to peer `%s' blocked for %llu ms\n"),
708 GNUNET_i2s (other), (unsigned long long) bt.rel_value); 708 GNUNET_i2s (other), (unsigned long long) bt.rel_value);
709 cp->ppd.migration_blocked_until = GNUNET_TIME_relative_to_absolute (bt); 709 cp->ppd.migration_blocked_until = GNUNET_TIME_relative_to_absolute (bt);
710 if (cp->mig_revive_task == GNUNET_SCHEDULER_NO_TASK) 710 if (GNUNET_SCHEDULER_NO_TASK == cp->mig_revive_task)
711 { 711 {
712 GSF_push_stop_ (cp); 712 GSF_push_stop_ (cp);
713 cp->mig_revive_task = 713 cp->mig_revive_task =
@@ -732,7 +732,7 @@ copy_reply (void *cls, size_t buf_size, void *buf)
732 struct PutMessage *pm = cls; 732 struct PutMessage *pm = cls;
733 size_t size; 733 size_t size;
734 734
735 if (buf != NULL) 735 if (NULL != buf)
736 { 736 {
737 GNUNET_assert (buf_size >= ntohs (pm->header.size)); 737 GNUNET_assert (buf_size >= ntohs (pm->header.size));
738 size = ntohs (pm->header.size); 738 size = ntohs (pm->header.size);
@@ -765,7 +765,7 @@ free_pending_request (struct PeerRequest *peerreq,
765{ 765{
766 struct GSF_ConnectedPeer *cp = peerreq->cp; 766 struct GSF_ConnectedPeer *cp = peerreq->cp;
767 767
768 if (peerreq->kill_task != GNUNET_SCHEDULER_NO_TASK) 768 if (GNUNET_SCHEDULER_NO_TASK != peerreq->kill_task)
769 { 769 {
770 GNUNET_SCHEDULER_cancel (peerreq->kill_task); 770 GNUNET_SCHEDULER_cancel (peerreq->kill_task);
771 peerreq->kill_task = GNUNET_SCHEDULER_NO_TASK; 771 peerreq->kill_task = GNUNET_SCHEDULER_NO_TASK;
@@ -910,8 +910,8 @@ handle_p2p_reply (void *cls, enum GNUNET_BLOCK_EvaluationResult eval,
910 free_pending_request (peerreq, &prd->query); 910 free_pending_request (peerreq, &prd->query);
911 return; 911 return;
912 } 912 }
913 GNUNET_break (type != GNUNET_BLOCK_TYPE_ANY); 913 GNUNET_break (GNUNET_BLOCK_TYPE_ANY != type);
914 if ((prd->type != type) && (prd->type != GNUNET_BLOCK_TYPE_ANY)) 914 if ((prd->type != type) && (GNUNET_BLOCK_TYPE_ANY != prd->type))
915 { 915 {
916 GNUNET_STATISTICS_update (GSF_stats, 916 GNUNET_STATISTICS_update (GSF_stats,
917 gettext_noop 917 gettext_noop
@@ -931,7 +931,7 @@ handle_p2p_reply (void *cls, enum GNUNET_BLOCK_EvaluationResult eval,
931 GNUNET_break (0); 931 GNUNET_break (0);
932 return; 932 return;
933 } 933 }
934 if ((reply_anonymity_level != UINT32_MAX) && (reply_anonymity_level > 1)) 934 if ((UINT32_MAX != reply_anonymity_level) && (reply_anonymity_level > 1))
935 { 935 {
936 if (reply_anonymity_level - 1 > GSF_cover_content_count) 936 if (reply_anonymity_level - 1 > GSF_cover_content_count)
937 { 937 {
@@ -950,8 +950,8 @@ handle_p2p_reply (void *cls, enum GNUNET_BLOCK_EvaluationResult eval,
950 pm->type = htonl (type); 950 pm->type = htonl (type);
951 pm->expiration = GNUNET_TIME_absolute_hton (expiration); 951 pm->expiration = GNUNET_TIME_absolute_hton (expiration);
952 memcpy (&pm[1], data, data_len); 952 memcpy (&pm[1], data, data_len);
953 if ((reply_anonymity_level != UINT32_MAX) && (reply_anonymity_level != 0) && 953 if ((UINT32_MAX != reply_anonymity_level) && (0 != reply_anonymity_level) &&
954 (GSF_enable_randomized_delays == GNUNET_YES)) 954 (GNUNET_YES == GSF_enable_randomized_delays))
955 { 955 {
956 struct GSF_DelayedHandle *dh; 956 struct GSF_DelayedHandle *dh;
957 957
@@ -969,7 +969,7 @@ handle_p2p_reply (void *cls, enum GNUNET_BLOCK_EvaluationResult eval,
969 (void) GSF_peer_transmit_ (cp, GNUNET_NO, UINT32_MAX, REPLY_TIMEOUT, msize, 969 (void) GSF_peer_transmit_ (cp, GNUNET_NO, UINT32_MAX, REPLY_TIMEOUT, msize,
970 &copy_reply, pm); 970 &copy_reply, pm);
971 } 971 }
972 if (eval != GNUNET_BLOCK_EVALUATION_OK_LAST) 972 if (GNUNET_BLOCK_EVALUATION_OK_LAST != eval)
973 return; 973 return;
974 if (GNUNET_SCHEDULER_NO_TASK == peerreq->kill_task) 974 if (GNUNET_SCHEDULER_NO_TASK == peerreq->kill_task)
975 { 975 {
@@ -994,9 +994,9 @@ handle_p2p_reply (void *cls, enum GNUNET_BLOCK_EvaluationResult eval,
994static int 994static int
995change_peer_respect (struct GSF_ConnectedPeer *cp, int value) 995change_peer_respect (struct GSF_ConnectedPeer *cp, int value)
996{ 996{
997 if (value == 0) 997 if (0 == value)
998 return 0; 998 return 0;
999 GNUNET_assert (cp != NULL); 999 GNUNET_assert (NULL != cp);
1000 if (value > 0) 1000 if (value > 0)
1001 { 1001 {
1002 if (cp->ppd.respect + value < cp->ppd.respect) 1002 if (cp->ppd.respect + value < cp->ppd.respect)
@@ -1038,7 +1038,7 @@ bound_priority (uint32_t prio_in, struct GSF_ConnectedPeer *cp)
1038 int ld; 1038 int ld;
1039 1039
1040 ld = GSF_test_get_load_too_high_ (0); 1040 ld = GSF_test_get_load_too_high_ (0);
1041 if (ld == GNUNET_SYSERR) 1041 if (GNUNET_SYSERR == ld)
1042 { 1042 {
1043 GNUNET_STATISTICS_update (GSF_stats, 1043 GNUNET_STATISTICS_update (GSF_stats,
1044 gettext_noop 1044 gettext_noop
@@ -1057,12 +1057,12 @@ bound_priority (uint32_t prio_in, struct GSF_ConnectedPeer *cp)
1057 rret = ret; 1057 rret = ret;
1058 GSF_current_priorities = (GSF_current_priorities * (N - 1) + rret) / N; 1058 GSF_current_priorities = (GSF_current_priorities * (N - 1) + rret) / N;
1059 } 1059 }
1060 if ((ld == GNUNET_YES) && (ret > 0)) 1060 if ((GNUNET_YES == ld) && (ret > 0))
1061 { 1061 {
1062 /* try with charging */ 1062 /* try with charging */
1063 ld = GSF_test_get_load_too_high_ (ret); 1063 ld = GSF_test_get_load_too_high_ (ret);
1064 } 1064 }
1065 if (ld == GNUNET_YES) 1065 if (GNUNET_YES == ld)
1066 { 1066 {
1067 GNUNET_STATISTICS_update (GSF_stats, 1067 GNUNET_STATISTICS_update (GSF_stats,
1068 gettext_noop 1068 gettext_noop
@@ -1197,7 +1197,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
1197 cp = GSF_peer_get_ ((const struct GNUNET_PeerIdentity *) &opt[bits++]); 1197 cp = GSF_peer_get_ ((const struct GNUNET_PeerIdentity *) &opt[bits++]);
1198 else 1198 else
1199 cp = cps; 1199 cp = cps;
1200 if (cp == NULL) 1200 if (NULL == cp)
1201 { 1201 {
1202 if (0 != (bm & GET_MESSAGE_BIT_RETURN_TO)) 1202 if (0 != (bm & GET_MESSAGE_BIT_RETURN_TO))
1203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1203 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1231,12 +1231,12 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other,
1231 GNUNET_h2s (&gm->query), (unsigned int) type, GNUNET_i2s (other), 1231 GNUNET_h2s (&gm->query), (unsigned int) type, GNUNET_i2s (other),
1232 (unsigned int) bm); 1232 (unsigned int) bm);
1233 namespace = (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE)) ? &opt[bits++] : NULL; 1233 namespace = (0 != (bm & GET_MESSAGE_BIT_SKS_NAMESPACE)) ? &opt[bits++] : NULL;
1234 if ((type == GNUNET_BLOCK_TYPE_FS_SBLOCK) && (namespace == NULL)) 1234 if ((GNUNET_BLOCK_TYPE_FS_SBLOCK == type) && (NULL == namespace))
1235 { 1235 {
1236 GNUNET_break_op (0); 1236 GNUNET_break_op (0);
1237 return NULL; 1237 return NULL;
1238 } 1238 }
1239 if ((type != GNUNET_BLOCK_TYPE_FS_SBLOCK) && (namespace != NULL)) 1239 if ((GNUNET_BLOCK_TYPE_FS_SBLOCK != type) && (NULL != namespace))
1240 { 1240 {
1241 GNUNET_break_op (0); 1241 GNUNET_break_op (0);
1242 return NULL; 1242 return NULL;
@@ -1403,7 +1403,7 @@ GSF_peer_transmit_ (struct GSF_ConnectedPeer *cp, int is_query,
1403 /* insertion sort (by priority, descending) */ 1403 /* insertion sort (by priority, descending) */
1404 prev = NULL; 1404 prev = NULL;
1405 pos = cp->pth_head; 1405 pos = cp->pth_head;
1406 while ((pos != NULL) && (pos->priority > priority)) 1406 while ((NULL != pos) && (pos->priority > priority))
1407 { 1407 {
1408 prev = pos; 1408 prev = pos;
1409 pos = pos->next; 1409 pos = pos->next;
@@ -1430,7 +1430,7 @@ GSF_peer_transmit_cancel_ (struct GSF_PeerTransmitHandle *pth)
1430{ 1430{
1431 struct GSF_ConnectedPeer *cp; 1431 struct GSF_ConnectedPeer *cp;
1432 1432
1433 if (pth->timeout_task != GNUNET_SCHEDULER_NO_TASK) 1433 if (GNUNET_SCHEDULER_NO_TASK != pth->timeout_task)
1434 { 1434 {
1435 GNUNET_SCHEDULER_cancel (pth->timeout_task); 1435 GNUNET_SCHEDULER_cancel (pth->timeout_task);
1436 pth->timeout_task = GNUNET_SCHEDULER_NO_TASK; 1436 pth->timeout_task = GNUNET_SCHEDULER_NO_TASK;
@@ -1711,7 +1711,7 @@ GSF_block_peer_migration_ (struct GSF_ConnectedPeer *cp,
1711 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %llu ms\n", 1711 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking to stop migration for %llu ms\n",
1712 (unsigned long long) GNUNET_TIME_absolute_get_remaining (block_time).rel_value); 1712 (unsigned long long) GNUNET_TIME_absolute_get_remaining (block_time).rel_value);
1713 cp->last_migration_block = block_time; 1713 cp->last_migration_block = block_time;
1714 if (cp->migration_pth != NULL) 1714 if (NULL != cp->migration_pth)
1715 GSF_peer_transmit_cancel_ (cp->migration_pth); 1715 GSF_peer_transmit_cancel_ (cp->migration_pth);
1716 cp->migration_pth = 1716 cp->migration_pth =
1717 GSF_peer_transmit_ (cp, GNUNET_SYSERR, UINT32_MAX, 1717 GSF_peer_transmit_ (cp, GNUNET_SYSERR, UINT32_MAX,
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c
index c70f3cc84..904d02832 100644
--- a/src/fs/gnunet-service-fs_pe.c
+++ b/src/fs/gnunet-service-fs_pe.c
@@ -439,7 +439,7 @@ schedule_peer_transmission (void *cls,
439 struct GNUNET_TIME_Relative delay; 439 struct GNUNET_TIME_Relative delay;
440 440
441 pp->task = GNUNET_SCHEDULER_NO_TASK; 441 pp->task = GNUNET_SCHEDULER_NO_TASK;
442 if (pp->pth != NULL) 442 if (NULL != pp->pth)
443 { 443 {
444 GSF_peer_transmit_cancel_ (pp->pth); 444 GSF_peer_transmit_cancel_ (pp->pth);
445 pp->pth = NULL; 445 pp->pth = NULL;
@@ -641,7 +641,10 @@ GSF_plan_notify_peer_disconnect_ (const struct GSF_ConnectedPeer *cp)
641 GNUNET_CONTAINER_multihashmap_remove (plans, &id.hashPubKey, 641 GNUNET_CONTAINER_multihashmap_remove (plans, &id.hashPubKey,
642 pp)); 642 pp));
643 if (NULL != pp->pth) 643 if (NULL != pp->pth)
644 {
644 GSF_peer_transmit_cancel_ (pp->pth); 645 GSF_peer_transmit_cancel_ (pp->pth);
646 pp->pth = NULL;
647 }
645 if (GNUNET_SCHEDULER_NO_TASK != pp->task) 648 if (GNUNET_SCHEDULER_NO_TASK != pp->task)
646 { 649 {
647 GNUNET_SCHEDULER_cancel (pp->task); 650 GNUNET_SCHEDULER_cancel (pp->task);