aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-10 11:15:00 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-10 11:15:00 +0000
commitfa2a3f804567e2c8181a9fc303b9ebe4e7ac0173 (patch)
treea61b839a411a40c2349feb321c58f56ee4614710 /src
parent376b5f749c03e1ff149c2e8248eed9bec928872a (diff)
downloadgnunet-fa2a3f804567e2c8181a9fc303b9ebe4e7ac0173.tar.gz
gnunet-fa2a3f804567e2c8181a9fc303b9ebe4e7ac0173.zip
fakeit
Diffstat (limited to 'src')
-rw-r--r--src/ats/ats_api_peer_change_preference.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ats/ats_api_peer_change_preference.c b/src/ats/ats_api_peer_change_preference.c
index 84fc2bf6c..ec8140c14 100644
--- a/src/ats/ats_api_peer_change_preference.c
+++ b/src/ats/ats_api_peer_change_preference.c
@@ -70,9 +70,23 @@ exec_pcp (void *cls,
70 int32_t want_reserv; 70 int32_t want_reserv;
71 int32_t got_reserv; 71 int32_t got_reserv;
72 struct GNUNET_TIME_Relative rdelay; 72 struct GNUNET_TIME_Relative rdelay;
73 struct AllocationRecord *ar;
73 74
74 rdelay = GNUNET_TIME_UNIT_ZERO; 75 rdelay = GNUNET_TIME_UNIT_ZERO;
75 want_reserv = irc->amount; 76 want_reserv = irc->amount;
77 ar = GNUNET_CONTAINER_multihashmap_get (irc->h->peers, &irc->peer.hashPubKey);
78 if (NULL == ar)
79 {
80 /* attempt to change preference on peer that is not connected */
81 /* FIXME: this can happen if the 'service' didn't yet tell us about
82 a new connection, fake it! */
83 irc->info (irc->info_cls,
84 &irc->peer,
85 want_reserv,
86 rdelay);
87 GNUNET_free (irc);
88 return;
89 }
76 if (want_reserv < 0) 90 if (want_reserv < 0)
77 { 91 {
78 got_reserv = want_reserv; 92 got_reserv = want_reserv;
@@ -122,19 +136,10 @@ GNUNET_ATS_peer_change_preference (struct GNUNET_ATS_Handle *h,
122 info, void *info_cls) 136 info, void *info_cls)
123{ 137{
124 struct GNUNET_ATS_InformationRequestContext *irc; 138 struct GNUNET_ATS_InformationRequestContext *irc;
125 struct AllocationRecord *ar;
126 139
127 ar = GNUNET_CONTAINER_multihashmap_get (h->peers, &peer->hashPubKey);
128 if (NULL == ar)
129 {
130 /* attempt to change preference on peer that is not connected */
131 GNUNET_assert (0);
132 return NULL;
133 }
134 irc = GNUNET_malloc (sizeof (struct GNUNET_ATS_InformationRequestContext)); 140 irc = GNUNET_malloc (sizeof (struct GNUNET_ATS_InformationRequestContext));
135 irc->h = h; 141 irc->h = h;
136 irc->peer = *peer; 142 irc->peer = *peer;
137 irc->ar = ar;
138 irc->amount = amount; 143 irc->amount = amount;
139 irc->preference = preference; 144 irc->preference = preference;
140 irc->info = info; 145 irc->info = info;