[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27321 - gnunet/src/experimentation
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27321 - gnunet/src/experimentation |
Date: |
Tue, 28 May 2013 12:02:57 +0200 |
Author: wachs
Date: 2013-05-28 12:02:57 +0200 (Tue, 28 May 2013)
New Revision: 27321
Modified:
gnunet/src/experimentation/gnunet-daemon-experimentation.h
gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
gnunet/src/experimentation/test_experimentation_clique.c
gnunet/src/experimentation/test_experimentation_clique.conf
Log:
changes
Modified: gnunet/src/experimentation/gnunet-daemon-experimentation.h
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation.h 2013-05-28
09:52:15 UTC (rev 27320)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation.h 2013-05-28
10:02:57 UTC (rev 27321)
@@ -192,12 +192,17 @@
/**
* Experimentation response message
* Sent if peer is running the daemon
+ *
+ * This struct is followed by issuer identities:
+ * (issuer_count * struct Experimentation_Request_Issuer)
*/
struct Experimentation_Response
{
struct GNUNET_MessageHeader msg;
uint32_t capabilities;
+
+ uint32_t issuer_count;
};
Modified: gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
2013-05-28 09:52:15 UTC (rev 27320)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
2013-05-28 10:02:57 UTC (rev 27321)
@@ -416,7 +416,7 @@
GSE_my_issuer_count = GNUNET_CONTAINER_multihashmap_size
(valid_issuers);
GSE_my_issuer = GNUNET_malloc (GSE_my_issuer_count * sizeof (struct
Experimentation_Issuer));
GNUNET_CONTAINER_multihashmap_iterate (valid_issuers, &create_issuer,
GSE_my_issuer);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Daemon has %u issuers\n"),
GSE_my_issuer_count);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Daemon has %u issuers\n"),
GSE_my_issuer_count);
experiments = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
/* Load experiments from file */
Modified: gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
2013-05-28 09:52:15 UTC (rev 27320)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
2013-05-28 10:02:57 UTC (rev 27321)
@@ -276,7 +276,7 @@
struct Experimentation_Response msg;
size_t ri_size = GSE_my_issuer_count * sizeof (struct
Experimentation_Issuer);
size_t msg_size = sizeof (msg);
- size_t total_size = msg_size;
+ size_t total_size = msg_size + ri_size;
n->cth = NULL;
if (buf == NULL)
@@ -290,6 +290,7 @@
msg.msg.size = htons (total_size);
msg.msg.type = htons (GNUNET_MESSAGE_TYPE_EXPERIMENTATION_RESPONSE);
msg.capabilities = htonl (GSE_node_capabilities);
+ msg.issuer_count = htonl (GSE_my_issuer_count);
memcpy (buf, &msg, msg_size);
memcpy (&buf[msg_size], GSE_my_issuer, ri_size);
@@ -454,19 +455,37 @@
const struct GNUNET_MessageHeader *message)
{
struct Node *n;
- struct Experimentation_Request *rm = (struct Experimentation_Request *)
message;
+ struct Experimentation_Response *rm = (struct Experimentation_Response
*) message;
+ struct Experimentation_Issuer *rmi = (struct Experimentation_Issuer *)
&rm[1];
+ uint32_t ic;
+ uint32_t ic_accepted;
+ int make_active;
+ unsigned int c1;
+ unsigned int c2;
+
+ if (ntohs (message->size) < sizeof (struct Experimentation_Response))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ ic = ntohl (rm->issuer_count);
+ if (ntohs (message->size) != sizeof (struct Experimentation_Response) +
ic * sizeof (struct Experimentation_Issuer))
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ make_active = GNUNET_NO;
if (NULL != (n = GNUNET_CONTAINER_multihashmap_get (nodes_active,
&peer->hashPubKey)))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Received %s from
%s peer `%s'\n"),
"RESPONSE", "active", GNUNET_i2s
(peer));
- n->capabilities = ntohl (rm->capabilities);
}
else if (NULL != (n = GNUNET_CONTAINER_multihashmap_get
(nodes_requested, &peer->hashPubKey)))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Received %s from
%s peer `%s'\n"),
"RESPONSE", "requested", GNUNET_i2s
(peer));
- n->capabilities = ntohl (rm->capabilities);
GNUNET_CONTAINER_multihashmap_remove (nodes_requested,
&peer->hashPubKey, n);
if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task)
{
@@ -479,16 +498,15 @@
n->cth = NULL;
}
update_stats (nodes_requested);
- node_make_active (n);
+ make_active = GNUNET_YES;
}
else if (NULL != (n = GNUNET_CONTAINER_multihashmap_get
(nodes_inactive, &peer->hashPubKey)))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Received %s from
peer `%s'\n"),
"RESPONSE", "inactive", GNUNET_i2s
(peer));
- n->capabilities = ntohl (rm->capabilities);
GNUNET_CONTAINER_multihashmap_remove (nodes_inactive,
&peer->hashPubKey, n);
update_stats (nodes_inactive);
- node_make_active (n);
+ make_active = GNUNET_YES;
}
else
{
@@ -496,6 +514,34 @@
"RESPONSE", "unknown", GNUNET_i2s
(peer));
return;
}
+
+ /* Update */
+ n->capabilities = ntohl (rm->capabilities);
+
+ /* Filter accepted issuer */
+ ic_accepted = 0;
+ for (c1 = 0; c1 < ic; c1++)
+ {
+ if (GNUNET_YES ==
GNUNET_EXPERIMENTATION_experiments_issuer_accepted(&rmi[c1].issuer_id))
+ ic_accepted ++;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Response from peer `%s' with %u
issuers, we accepted %u issuer \n"),
+ GNUNET_i2s (peer), ic, ic_accepted);
+ GNUNET_free_non_null (n->issuer_id);
+ n->issuer_id = GNUNET_malloc (ic_accepted * sizeof (struct
GNUNET_PeerIdentity));
+ c2 = 0;
+ for (c1 = 0; c1 < ic; c1++)
+ {
+ if (GNUNET_YES ==
GNUNET_EXPERIMENTATION_experiments_issuer_accepted(&rmi[c1].issuer_id))
+ {
+ n->issuer_id[c2] = rmi[c1].issuer_id;
+ c2 ++;
+ }
+ }
+ n->issuer_count = ic_accepted;
+
+ if (GNUNET_YES == make_active)
+ node_make_active (n);
}
/**
Modified: gnunet/src/experimentation/test_experimentation_clique.c
===================================================================
--- gnunet/src/experimentation/test_experimentation_clique.c 2013-05-28
09:52:15 UTC (rev 27320)
+++ gnunet/src/experimentation/test_experimentation_clique.c 2013-05-28
10:02:57 UTC (rev 27321)
@@ -33,7 +33,7 @@
/**
* Number of peers we want to start
*/
-#define NUM_PEERS 10
+#define NUM_PEERS 20
#define NUM_ISSUER 1
Modified: gnunet/src/experimentation/test_experimentation_clique.conf
===================================================================
--- gnunet/src/experimentation/test_experimentation_clique.conf 2013-05-28
09:52:15 UTC (rev 27320)
+++ gnunet/src/experimentation/test_experimentation_clique.conf 2013-05-28
10:02:57 UTC (rev 27321)
@@ -36,7 +36,7 @@
PORT = 12365
[experimentation]
-#PREFIX = valgrind --leak-check=full
+PREFIX = valgrind --leak-check=full
ISSUERS =
TFRM29O2RQNKLVBQIGODJ6GD58LSQ2NM9TNFBC6N48BRJHQO38Q73N2OM3V4CLKDM6CILQV4CU8PMJDRG0FNB0PDI057DBRANMLPLRG
EXPERIMENTS = test_experiments.exp
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27321 - gnunet/src/experimentation,
gnunet <=