diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-19 12:39:01 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-19 12:39:01 +0000 |
commit | ad4437bd9a5d28b8b966abfddaeec034ad237964 (patch) | |
tree | f3053dd63d95b96ab07f74a3a43eae932e4ba0ff /src/fs | |
parent | 1b41ef00317b5f38a7860bfa4711a03552744241 (diff) | |
download | gnunet-ad4437bd9a5d28b8b966abfddaeec034ad237964.tar.gz gnunet-ad4437bd9a5d28b8b966abfddaeec034ad237964.zip |
cleanup+stats
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/gnunet-service-fs_cp.c | 27 | ||||
-rw-r--r-- | src/fs/perf_gnunet_service_fs_p2p.c | 2 |
2 files changed, 24 insertions, 5 deletions
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 0c852ec64..7643bdc9e 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c | |||
@@ -551,6 +551,11 @@ ats_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
551 | struct GSF_ConnectedPeer *cp = cls; | 551 | struct GSF_ConnectedPeer *cp = cls; |
552 | struct GSF_PeerTransmitHandle *pth; | 552 | struct GSF_PeerTransmitHandle *pth; |
553 | 553 | ||
554 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | ||
555 | "fs-ats-r", | ||
556 | "Reserved %d bytes / need to wait %llu ms for reservation\n", | ||
557 | (int) amount, | ||
558 | (unsigned long long) res_delay.rel_value); | ||
554 | cp->rc = NULL; | 559 | cp->rc = NULL; |
555 | if (0 == amount) | 560 | if (0 == amount) |
556 | { | 561 | { |
@@ -590,6 +595,10 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer, | |||
590 | char *fn; | 595 | char *fn; |
591 | uint32_t trust; | 596 | uint32_t trust; |
592 | 597 | ||
598 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | ||
599 | "fs-ats-r", | ||
600 | "Connected to peer %s\n", | ||
601 | GNUNET_i2s (peer)); | ||
593 | cp = GNUNET_malloc (sizeof (struct GSF_ConnectedPeer)); | 602 | cp = GNUNET_malloc (sizeof (struct GSF_ConnectedPeer)); |
594 | cp->ppd.pid = GNUNET_PEER_intern (peer); | 603 | cp->ppd.pid = GNUNET_PEER_intern (peer); |
595 | cp->ppd.transmission_delay = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_ZERO); | 604 | cp->ppd.transmission_delay = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_ZERO); |
@@ -607,6 +616,11 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer, | |||
607 | GNUNET_CONTAINER_multihashmap_put (cp_map, &peer->hashPubKey, | 616 | GNUNET_CONTAINER_multihashmap_put (cp_map, &peer->hashPubKey, |
608 | cp, | 617 | cp, |
609 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 618 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
619 | GNUNET_STATISTICS_set (GSF_stats, | ||
620 | gettext_noop | ||
621 | ("# connected peers"), | ||
622 | GNUNET_CONTAINER_multihashmap_size (cp_map), | ||
623 | GNUNET_NO); | ||
610 | update_atsi (cp, atsi); | 624 | update_atsi (cp, atsi); |
611 | GSF_push_start_ (cp); | 625 | GSF_push_start_ (cp); |
612 | return cp; | 626 | return cp; |
@@ -677,7 +691,7 @@ GSF_handle_p2p_migration_stop_ (void *cls, | |||
677 | struct GNUNET_TIME_Relative bt; | 691 | struct GNUNET_TIME_Relative bt; |
678 | 692 | ||
679 | msm = (const struct MigrationStopMessage *) message; | 693 | msm = (const struct MigrationStopMessage *) message; |
680 | cp = GNUNET_CONTAINER_multihashmap_get (cp_map, &other->hashPubKey); | 694 | cp = GSF_peer_get_ (other); |
681 | if (cp == NULL) | 695 | if (cp == NULL) |
682 | { | 696 | { |
683 | GNUNET_break (0); | 697 | GNUNET_break (0); |
@@ -1151,7 +1165,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, | |||
1151 | GSF_cover_query_count++; | 1165 | GSF_cover_query_count++; |
1152 | bm = ntohl (gm->hash_bitmap); | 1166 | bm = ntohl (gm->hash_bitmap); |
1153 | bits = 0; | 1167 | bits = 0; |
1154 | cps = GNUNET_CONTAINER_multihashmap_get (cp_map, &other->hashPubKey); | 1168 | cps = GSF_peer_get_ (other); |
1155 | if (NULL == cps) | 1169 | if (NULL == cps) |
1156 | { | 1170 | { |
1157 | /* peer must have just disconnected */ | 1171 | /* peer must have just disconnected */ |
@@ -1162,7 +1176,7 @@ GSF_handle_p2p_query_ (const struct GNUNET_PeerIdentity *other, | |||
1162 | return NULL; | 1176 | return NULL; |
1163 | } | 1177 | } |
1164 | if (0 != (bm & GET_MESSAGE_BIT_RETURN_TO)) | 1178 | if (0 != (bm & GET_MESSAGE_BIT_RETURN_TO)) |
1165 | cp = GNUNET_CONTAINER_multihashmap_get (cp_map, &opt[bits++]); | 1179 | cp = GSF_peer_get_ ((const struct GNUNET_PeerIdentity*) &opt[bits++]); |
1166 | else | 1180 | else |
1167 | cp = cps; | 1181 | cp = cps; |
1168 | if (cp == NULL) | 1182 | if (cp == NULL) |
@@ -1521,13 +1535,18 @@ GSF_peer_disconnect_handler_ (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
1521 | struct GSF_PeerTransmitHandle *pth; | 1535 | struct GSF_PeerTransmitHandle *pth; |
1522 | struct GSF_DelayedHandle *dh; | 1536 | struct GSF_DelayedHandle *dh; |
1523 | 1537 | ||
1524 | cp = GNUNET_CONTAINER_multihashmap_get (cp_map, &peer->hashPubKey); | 1538 | cp = GSF_peer_get_ (peer); |
1525 | if (NULL == cp) | 1539 | if (NULL == cp) |
1526 | return; /* must have been disconnect from core with | 1540 | return; /* must have been disconnect from core with |
1527 | * 'peer' == my_id, ignore */ | 1541 | * 'peer' == my_id, ignore */ |
1528 | GNUNET_assert (GNUNET_YES == | 1542 | GNUNET_assert (GNUNET_YES == |
1529 | GNUNET_CONTAINER_multihashmap_remove (cp_map, | 1543 | GNUNET_CONTAINER_multihashmap_remove (cp_map, |
1530 | &peer->hashPubKey, cp)); | 1544 | &peer->hashPubKey, cp)); |
1545 | GNUNET_STATISTICS_set (GSF_stats, | ||
1546 | gettext_noop | ||
1547 | ("# connected peers"), | ||
1548 | GNUNET_CONTAINER_multihashmap_size (cp_map), | ||
1549 | GNUNET_NO); | ||
1531 | if (NULL != cp->migration_pth) | 1550 | if (NULL != cp->migration_pth) |
1532 | { | 1551 | { |
1533 | GSF_peer_transmit_cancel_ (cp->migration_pth); | 1552 | GSF_peer_transmit_cancel_ (cp->migration_pth); |
diff --git a/src/fs/perf_gnunet_service_fs_p2p.c b/src/fs/perf_gnunet_service_fs_p2p.c index bff884e32..bb8c8d8c2 100644 --- a/src/fs/perf_gnunet_service_fs_p2p.c +++ b/src/fs/perf_gnunet_service_fs_p2p.c | |||
@@ -32,7 +32,7 @@ | |||
32 | /** | 32 | /** |
33 | * File-size we use for testing. | 33 | * File-size we use for testing. |
34 | */ | 34 | */ |
35 | #define FILESIZE (1024 * 1024 * 1) | 35 | #define FILESIZE (1024 * 1024 * 10) |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * How long until we give up on transmitting the message? | 38 | * How long until we give up on transmitting the message? |