gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r17309 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r17309 - gnunet/src/ats
Date: Mon, 10 Oct 2011 13:15:00 +0200

Author: grothoff
Date: 2011-10-10 13:15:00 +0200 (Mon, 10 Oct 2011)
New Revision: 17309

Modified:
   gnunet/src/ats/ats_api_peer_change_preference.c
Log:
fakeit

Modified: gnunet/src/ats/ats_api_peer_change_preference.c
===================================================================
--- gnunet/src/ats/ats_api_peer_change_preference.c     2011-10-10 11:09:42 UTC 
(rev 17308)
+++ gnunet/src/ats/ats_api_peer_change_preference.c     2011-10-10 11:15:00 UTC 
(rev 17309)
@@ -70,9 +70,23 @@
   int32_t want_reserv;
   int32_t got_reserv;
   struct GNUNET_TIME_Relative rdelay;
+  struct AllocationRecord *ar;
 
   rdelay = GNUNET_TIME_UNIT_ZERO;
   want_reserv = irc->amount;
+  ar = GNUNET_CONTAINER_multihashmap_get (irc->h->peers, 
&irc->peer.hashPubKey);  
+  if (NULL == ar)
+  {
+    /* attempt to change preference on peer that is not connected */
+    /* FIXME: this can happen if the 'service' didn't yet tell us about
+       a new connection, fake it! */
+    irc->info (irc->info_cls,
+              &irc->peer,
+              want_reserv,
+              rdelay);
+    GNUNET_free (irc);
+    return;
+  }
   if (want_reserv < 0)
   {
     got_reserv = want_reserv;
@@ -122,19 +136,10 @@
                                     info, void *info_cls)
 {
   struct GNUNET_ATS_InformationRequestContext *irc;
-  struct AllocationRecord *ar;
 
-  ar = GNUNET_CONTAINER_multihashmap_get (h->peers, &peer->hashPubKey);
-  if (NULL == ar)
-  {
-    /* attempt to change preference on peer that is not connected */
-    GNUNET_assert (0);
-    return NULL;
-  }
   irc = GNUNET_malloc (sizeof (struct GNUNET_ATS_InformationRequestContext));
   irc->h = h;
   irc->peer = *peer;
-  irc->ar = ar;
   irc->amount = amount;
   irc->preference = preference;
   irc->info = info;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]