aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs_cp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-02-15 15:30:06 +0000
committerChristian Grothoff <christian@grothoff.org>2011-02-15 15:30:06 +0000
commitd5c5c5b962115be085a1cc71a0480d7e2a3eda73 (patch)
tree96bdd8c004a00556ac9df07393aecf17f723636e /src/fs/gnunet-service-fs_cp.c
parent0ad72d359ab3ea5f232f4a8a0eb04700e8c84b49 (diff)
downloadgnunet-d5c5c5b962115be085a1cc71a0480d7e2a3eda73.tar.gz
gnunet-d5c5c5b962115be085a1cc71a0480d7e2a3eda73.zip
stuff
Diffstat (limited to 'src/fs/gnunet-service-fs_cp.c')
-rw-r--r--src/fs/gnunet-service-fs_cp.c51
1 files changed, 33 insertions, 18 deletions
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index d88598be7..3ce03be2e 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -981,34 +981,49 @@ GSF_peer_transmit_cancel_ (struct GSF_PeerTransmitHandle *pth)
981 * @param cp responding peer (will be updated) 981 * @param cp responding peer (will be updated)
982 * @param request_time time at which the original query was transmitted 982 * @param request_time time at which the original query was transmitted
983 * @param request_priority priority of the original request 983 * @param request_priority priority of the original request
984 * @param initiator_client local client on responsible for query (or NULL)
985 * @param initiator_peer other peer responsible for query (or NULL)
986 */ 984 */
987void 985void
988GSF_peer_update_performance_ (struct GSF_ConnectedPeer *cp, 986GSF_peer_update_performance_ (struct GSF_ConnectedPeer *cp,
989 struct GNUNET_TIME_Absolute request_time, 987 struct GNUNET_TIME_Absolute request_time,
990 uint32_t request_priority, 988 uint32_t request_priority)
991 const struct GSF_LocalClient *initiator_client,
992 const struct GSF_ConnectedPeer *initiator_peer)
993{ 989{
994 struct GNUNET_TIME_Relative delay; 990 struct GNUNET_TIME_Relative delay;
995 unsigned int i;
996 991
997 delay = GNUNET_TIME_absolute_get_duration (request_time); 992 delay = GNUNET_TIME_absolute_get_duration (request_time);
998 cp->ppd.avg_reply_delay = (cp->ppd.avg_reply_delay * (RUNAVG_DELAY_N-1) + delay.rel_value) / RUNAVG_DELAY_N; 993 cp->ppd.avg_reply_delay = (cp->ppd.avg_reply_delay * (RUNAVG_DELAY_N-1) + delay.rel_value) / RUNAVG_DELAY_N;
999 cp->ppd.avg_priority = (cp->avg_priority * (RUNAVG_DELAY_N-1) + request_priority) / RUNAVG_DELAY_N; 994 cp->ppd.avg_priority = (cp->avg_priority * (RUNAVG_DELAY_N-1) + request_priority) / RUNAVG_DELAY_N;
1000 if (NULL != initiator_client) 995}
1001 { 996
1002 cp->ppd.last_client_replies[cp->last_client_replies_woff++ % CS2P_SUCCESS_LIST_SIZE] = initiator_client; 997
1003 } 998/**
1004 else if (NULL != initiator_peer) 999 * Report on receiving a reply in response to an initiating client.
1005 { 1000 * Remember that this peer is good for this client.
1006 GNUNET_PEER_change_rc (cp->ppd.last_p2p_replies[cp->last_p2p_replies_woff % P2P_SUCCESS_LIST_SIZE], -1); 1001 *
1007 cp->ppd.last_p2p_replies[cp->last_p2p_replies_woff++ % P2P_SUCCESS_LIST_SIZE] = initiator_peer->pid; 1002 * @param cp responding peer (will be updated)
1008 GNUNET_PEER_change_rc (initiator_peer->pid, 1); 1003 * @param initiator_client local client on responsible for query
1009 } 1004 */
1010 else 1005void
1011 GNUNET_break (0); 1006GSF_peer_update_responder_client_ (struct GSF_ConnectedPeer *cp,
1007 const struct GSF_LocalClient *initiator_client)
1008{
1009 cp->ppd.last_client_replies[cp->last_client_replies_woff++ % CS2P_SUCCESS_LIST_SIZE] = initiator_client;
1010}
1011
1012
1013/**
1014 * Report on receiving a reply in response to an initiating peer.
1015 * Remember that this peer is good for this initiating peer.
1016 *
1017 * @param cp responding peer (will be updated)
1018 * @param initiator_peer other peer responsible for query
1019 */
1020void
1021GSF_peer_update_responder_peer_ (struct GSF_ConnectedPeer *cp,
1022 const struct GSF_ConnectedPeer *initiator_peer)
1023{
1024 GNUNET_PEER_change_rc (cp->ppd.last_p2p_replies[cp->last_p2p_replies_woff % P2P_SUCCESS_LIST_SIZE], -1);
1025 cp->ppd.last_p2p_replies[cp->last_p2p_replies_woff++ % P2P_SUCCESS_LIST_SIZE] = initiator_peer->pid;
1026 GNUNET_PEER_change_rc (initiator_peer->pid, 1);
1012} 1027}
1013 1028
1014 1029