gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r27320 - gnunet/src/experimentation


From: gnunet
Subject: [GNUnet-SVN] r27320 - gnunet/src/experimentation
Date: Tue, 28 May 2013 11:52:16 +0200

Author: wachs
Date: 2013-05-28 11:52:15 +0200 (Tue, 28 May 2013)
New Revision: 27320

Modified:
   gnunet/src/experimentation/gnunet-daemon-experimentation.h
   gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
   gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
Log:
changes


Modified: gnunet/src/experimentation/gnunet-daemon-experimentation.h
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation.h  2013-05-28 
09:35:18 UTC (rev 27319)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation.h  2013-05-28 
09:52:15 UTC (rev 27320)
@@ -66,7 +66,7 @@
 
 extern uint32_t GSE_my_issuer_count;
 
-extern struct Experimentation_Request_Issuer *GSE_my_issuer;
+extern struct Experimentation_Issuer *GSE_my_issuer;
 
 /**
  * Capabilities a node has or an experiment requires
@@ -167,7 +167,7 @@
        struct GNUNET_PeerIdentity *issuer_id;
 };
 
-struct Experimentation_Request_Issuer
+struct Experimentation_Issuer
 {
        struct GNUNET_PeerIdentity issuer_id;
 };

Modified: gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c      
2013-05-28 09:35:18 UTC (rev 27319)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c      
2013-05-28 09:52:15 UTC (rev 27320)
@@ -56,7 +56,7 @@
 
 uint32_t GSE_my_issuer_count;
 
-struct Experimentation_Request_Issuer *GSE_my_issuer;
+struct Experimentation_Issuer *GSE_my_issuer;
 
 
 /**
@@ -150,10 +150,6 @@
        struct GetCtx *get_ctx = cls;
        struct Experiment *e = value;
 
-       /* Check compability */
-       if (get_ctx->n->version.abs_value != e->version.abs_value)
-               return GNUNET_OK;
-
        get_ctx->get_cb (get_ctx->n, e);
 
        return GNUNET_OK;
@@ -418,7 +414,7 @@
        }
 
        GSE_my_issuer_count = GNUNET_CONTAINER_multihashmap_size 
(valid_issuers);
-       GSE_my_issuer = GNUNET_malloc (GSE_my_issuer_count * sizeof (struct 
Experimentation_Request_Issuer));
+       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);
 

Modified: gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c    
2013-05-28 09:35:18 UTC (rev 27319)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c    
2013-05-28 09:52:15 UTC (rev 27320)
@@ -204,7 +204,7 @@
        struct Node *n = cls;
        struct Experimentation_Request msg;
        size_t msg_size = sizeof (msg);
-       size_t ri_size = sizeof (struct Experimentation_Request_Issuer) * 
GSE_my_issuer_count;
+       size_t ri_size = sizeof (struct Experimentation_Issuer) * 
GSE_my_issuer_count;
        size_t total_size = msg_size + ri_size;
 
        memset (buf, '0', bufsize);
@@ -247,7 +247,7 @@
        c_issuers = GSE_my_issuer_count;
 
        size = sizeof (struct Experimentation_Request) +
-                                c_issuers * sizeof (struct 
Experimentation_Request_Issuer);
+                                c_issuers * sizeof (struct 
Experimentation_Issuer);
        n = GNUNET_malloc (sizeof (struct Node));
        n->id = *peer;
        n->timeout_task = GNUNET_SCHEDULER_add_delayed (EXP_RESPONSE_TIMEOUT, 
&remove_request, n);
@@ -274,7 +274,9 @@
 {
        struct Node *n = cls;
        struct Experimentation_Response msg;
-       size_t size = sizeof (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;
 
        n->cth = NULL;
   if (buf == NULL)
@@ -283,16 +285,17 @@
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client disconnected\n");
     return 0;
   }
-  GNUNET_assert (bufsize >= size);
+  GNUNET_assert (bufsize >= total_size);
 
-       msg.msg.size = htons (size);
+       msg.msg.size = htons (total_size);
        msg.msg.type = htons (GNUNET_MESSAGE_TYPE_EXPERIMENTATION_RESPONSE);
        msg.capabilities = htonl (GSE_node_capabilities);
-       memcpy (buf, &msg, size);
+       memcpy (buf, &msg, msg_size);
+       memcpy (&buf[msg_size], GSE_my_issuer, ri_size);
 
        GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Sending response to peer %s\n"),
                        GNUNET_i2s (&n->id));
-       return size;
+       return total_size;
 }
 
 
@@ -307,9 +310,10 @@
                        return;
        }
 
-       GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Scheduling experiment `%s' for 
peer %s\n"),
+       GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Starting experiment `%s' with 
peer %s\n"),
+                       e->name,
                        GNUNET_i2s (&n->id));
-       GNUNET_EXPERIMENTATION_scheduler_add (e);
+       //GNUNET_EXPERIMENTATION_scheduler_add (e);
        counter ++;
 }
 
@@ -329,7 +333,10 @@
 
        /* Request experiments for this node to start them */
        for (c1 = 0; c1 < n->issuer_count; c1++)
+       {
+
                GNUNET_EXPERIMENTATION_experiments_get (n, &n->issuer_id[c1], 
&get_experiments_cb);
+       }
 }
 
 
@@ -344,7 +351,7 @@
 {
        struct Node *n;
        struct Experimentation_Request *rm = (struct Experimentation_Request *) 
message;
-       struct Experimentation_Request_Issuer *rmi = (struct 
Experimentation_Request_Issuer *) &rm[1];
+       struct Experimentation_Issuer *rmi = (struct Experimentation_Issuer *) 
&rm[1];
        int c1;
        int c2;
        uint32_t ic;
@@ -357,7 +364,7 @@
                return;
        }
        ic = ntohl (rm->issuer_count);
-       if (ntohs (message->size) != sizeof (struct Experimentation_Request) + 
ic * sizeof (struct Experimentation_Request_Issuer))
+       if (ntohs (message->size) != sizeof (struct Experimentation_Request) + 
ic * sizeof (struct Experimentation_Issuer))
        {
                GNUNET_break (0);
                return;
@@ -382,7 +389,7 @@
                                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)))
        {
@@ -396,7 +403,7 @@
                        n = GNUNET_malloc (sizeof (struct Node));
                        n->id = *peer;
                        n->capabilities = NONE;
-                       node_make_active (n);
+                       make_active = GNUNET_YES;
        }
 
        /* Update node */
@@ -430,7 +437,9 @@
        /* Send response */
        n->cth = GNUNET_CORE_notify_transmit_ready (ch, GNUNET_NO, 0,
                                                                
GNUNET_TIME_relative_get_forever_(),
-                                                               peer, sizeof 
(struct Experimentation_Response),
+                                                               peer,
+                                                               sizeof (struct 
Experimentation_Response) +
+                                                               
GSE_my_issuer_count * sizeof (struct Experimentation_Issuer),
                                                                
send_response_cb, n);
 }
 




reply via email to

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