add address timeout
authorChristian Grothoff <christian@grothoff.org>
Fri, 12 Aug 2011 11:09:57 +0000 (11:09 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 12 Aug 2011 11:09:57 +0000 (11:09 +0000)
src/ats/ats_api.c
src/include/gnunet_ats_service.h
src/transport/gnunet-service-transport_validation.c

index 8609ac5a5a8553508db3a19e89898b81ec5a7376..36b215e5ba43f6e10c4336d8632ebf24afde9946 100644 (file)
@@ -179,12 +179,24 @@ count_connections (void *cls,
   return GNUNET_YES;
 }
 
+
+/**
+ * Closure for 'set_bw_connections'.
+ */
 struct SetBandwidthContext
 {
+  /**
+   * ATS handle.
+   */
   struct GNUNET_ATS_Handle *atc;
+
+  /**
+   * Bandwidth to assign.
+   */
   struct GNUNET_BANDWIDTH_Value32NBO bw;
 };
 
+
 /**
  * Set bandwidth based on record.
  *
@@ -303,9 +315,9 @@ suggest_address (void *cls,
  */
 struct GNUNET_ATS_SuggestionContext *
 GNUNET_ATS_suggest_address (struct GNUNET_ATS_Handle *atc,
-                        const struct GNUNET_PeerIdentity *peer,
-                        GNUNET_ATS_AddressSuggestionCallback cb,
-                        void *cb_cls)
+                           const struct GNUNET_PeerIdentity *peer,
+                           GNUNET_ATS_AddressSuggestionCallback cb,
+                           void *cb_cls)
 {
   struct GNUNET_ATS_SuggestionContext *asc;
 
@@ -357,8 +369,8 @@ GNUNET_ATS_suggest_address_cancel (struct GNUNET_ATS_SuggestionContext *asc)
  */
 struct GNUNET_ATS_Handle *
 GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
-             GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb,
-             void *alloc_cb_cls)
+                GNUNET_TRANSPORT_ATS_AllocationNotification alloc_cb,
+                void *alloc_cb_cls)
 {
   struct GNUNET_ATS_Handle *atc;
 
@@ -690,8 +702,8 @@ destroy_session (void *cls,
  */
 void
 GNUNET_ATS_session_destroyed (struct GNUNET_ATS_Handle *atc,
-                          const struct GNUNET_PeerIdentity *peer,
-                          const struct Session *session)
+                             const struct GNUNET_PeerIdentity *peer,
+                             const struct Session *session)
 {
   struct SessionDestroyContext sdc;
 
@@ -741,6 +753,7 @@ notify_valid (void *cls,
  * @param atc handle
  * @param public_key public key of the peer
  * @param peer identity of the peer
+ * @param valid_until how long is the address valid?
  * @param plugin_name name of the transport plugin
  * @param session session handle (if available)
  * @param plugin_addr address  (if available)
@@ -752,6 +765,7 @@ void
 GNUNET_ATS_address_update (struct GNUNET_ATS_Handle *atc,
                           const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key,
                           const struct GNUNET_PeerIdentity *peer,
+                          struct GNUNET_TIME_Absolute valid_until,
                           const char *plugin_name,
                           struct Session *session,
                           const void *plugin_addr,
index da54b24bead0025d878cf174f312a72879613cc1..64ed9a9a3305f6075e9b02ec9211aaee51466bc3 100644 (file)
@@ -207,6 +207,7 @@ GNUNET_ATS_session_destroyed (struct GNUNET_ATS_Handle *atc,
  * @param atc handle
  * @param public_key public key of the peer
  * @param peer identity of the new peer
+ * @param valid_until how long is the address valid?
  * @param plugin_name name of the transport plugin
  * @param session session handle (if available)
  * @param plugin_addr address  (if available)
@@ -218,6 +219,7 @@ void
 GNUNET_ATS_address_update (struct GNUNET_ATS_Handle *atc,
                           const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key,
                           const struct GNUNET_PeerIdentity *peer,
+                          struct GNUNET_TIME_Absolute valid_until,
                           const char *plugin_name,
                           struct Session *session,
                           const void *plugin_addr,
index 2b03e380571b5f25757c148206a7d40a5af6fd1c..f5e2bf82020f4104cc4ccda4d9282adca65028a8 100644 (file)
@@ -419,13 +419,14 @@ add_valid_address (void *cls,
   ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until,
                                              expiration);
   GNUNET_ATS_address_update (GST_ats,
-                         &public_key,
-                         &pid,
-                         tname,
-                         NULL,
-                         addr,
-                         addrlen,
-                         NULL, 0);
+                            &public_key,
+                            &pid,
+                            ve->valid_until,
+                            tname,
+                            NULL,
+                            addr,
+                            addrlen,
+                            NULL, 0);
   return GNUNET_OK;
 }
 
@@ -1038,13 +1039,14 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender,
   /* validity achieved, remember it! */
   ve->valid_until = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION);
   GNUNET_ATS_address_update (GST_ats,
-                         &ve->public_key,
-                         &ve->pid,
-                         ve->transport_name,
-                         NULL,
-                         ve->addr,
-                         ve->addrlen,
-                         NULL, 0); /* FIXME: compute and add latency here... */
+                            &ve->public_key,
+                            &ve->pid,
+                            ve->valid_until,
+                            ve->transport_name,
+                            NULL,
+                            ve->addr,
+                            ve->addrlen,
+                            NULL, 0); /* FIXME: compute and add latency here... */
 
   /* build HELLO to store in PEERINFO */
   hello = GNUNET_HELLO_create (&ve->public_key,