[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16463 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16463 - gnunet/src/transport |
Date: |
Fri, 12 Aug 2011 10:46:14 +0200 |
Author: grothoff
Date: 2011-08-12 10:46:13 +0200 (Fri, 12 Aug 2011)
New Revision: 16463
Modified:
gnunet/src/transport/gnunet-service-transport_validation.c
Log:
validation should notify async callbacks about updates
Modified: gnunet/src/transport/gnunet-service-transport_validation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_validation.c 2011-08-12
08:38:15 UTC (rev 16462)
+++ gnunet/src/transport/gnunet-service-transport_validation.c 2011-08-12
08:46:13 UTC (rev 16463)
@@ -248,6 +248,28 @@
/**
+ * Opaque handle to stop incremental validation address callbacks.
+ */
+struct GST_ValidationIteratorContext
+{
+ /**
+ * Function to call on each address.
+ */
+ GST_ValidationAddressCallback cb;
+
+ /**
+ * Closure for 'cb'.
+ */
+ void *cb_cls;
+
+ /**
+ * Which peer are we monitoring?
+ */
+ struct GNUNET_PeerIdentity target;
+};
+
+
+/**
* Head of linked list of HELLOs awaiting validation.
*/
static struct CheckHelloValidatedContext *chvc_head;
@@ -386,6 +408,34 @@
/**
+ * Notify validation watcher that an entry is now valid
+ *
+ * @param cls 'struct ValidationEntry' that is now valid
+ * @param key peer identity (unused)
+ * @param value a 'GST_ValidationIteratorContext' to notify
+ * @return GNUNET_YES (continue to iterate)
+ */
+static int
+notify_valid (void *cls,
+ const GNUNET_HashCode *key,
+ void *value)
+{
+ struct ValidationEntry *ve = cls;
+ struct GST_ValidationIteratorContext *vic = value;
+
+ vic->cb (vic->cb_cls,
+ &ve->public_key,
+ &vic->target,
+ ve->valid_until,
+ ve->validation_block,
+ ve->transport_name,
+ ve->addr,
+ ve->addrlen);
+ return GNUNET_OK;
+}
+
+
+/**
* Iterator which adds the given address to the set of validated
* addresses.
*
@@ -418,10 +468,13 @@
GNUNET_break (0);
return GNUNET_OK; /* invalid HELLO !? */
}
-
ve = find_validation_entry (&public_key, &pid, tname, addr, addrlen);
ve->valid_until = GNUNET_TIME_absolute_max (ve->valid_until,
expiration);
+ GNUNET_CONTAINER_multihashmap_get_multiple (notify_map,
+ &pid.hashPubKey,
+ ¬ify_valid,
+ ve);
return GNUNET_OK;
}
@@ -1092,28 +1145,6 @@
/**
- * Opaque handle to stop incremental validation address callbacks.
- */
-struct GST_ValidationIteratorContext
-{
- /**
- * Function to call on each address.
- */
- GST_ValidationAddressCallback cb;
-
- /**
- * Closure for 'cb'.
- */
- void *cb_cls;
-
- /**
- * Which peer are we monitoring?
- */
- struct GNUNET_PeerIdentity target;
-};
-
-
-/**
* Call the callback in the closure for each validation entry.
*
* @param cls the 'struct GST_ValidationIteratorContext'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16463 - gnunet/src/transport,
gnunet <=