gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r26863 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r26863 - gnunet/src/testbed
Date: Fri, 12 Apr 2013 15:28:31 +0200

Author: harsha
Date: 2013-04-12 15:28:31 +0200 (Fri, 12 Apr 2013)
New Revision: 26863

Modified:
   gnunet/src/testbed/gnunet-service-testbed.c
   gnunet/src/testbed/gnunet-service-testbed_links.c
   gnunet/src/testbed/testbed.h
   gnunet/src/testbed/testbed_api.c
Log:
- remove dead code as controller linking operation does not require host
-configuration explicitly


Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2013-04-12 12:51:08 UTC (rev 
26862)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2013-04-12 13:28:31 UTC (rev 
26863)
@@ -929,7 +929,8 @@
     {&handle_configure_shared_service, NULL,
      GNUNET_MESSAGE_TYPE_TESTBED_SHARE_SERVICE, 0},
     {&GST_handle_link_controllers, NULL,
-     GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS, 0},
+     GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS,
+     sizeof (struct GNUNET_TESTBED_ControllerLinkRequest)},
     {&GST_handle_peer_create, NULL, GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER, 
0},
     {&GST_handle_peer_destroy, NULL, GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER,
      sizeof (struct GNUNET_TESTBED_PeerDestroyMessage)},

Modified: gnunet/src/testbed/gnunet-service-testbed_links.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_links.c   2013-04-12 12:51:08 UTC 
(rev 26862)
+++ gnunet/src/testbed/gnunet-service-testbed_links.c   2013-04-12 13:28:31 UTC 
(rev 26863)
@@ -946,17 +946,15 @@
  */
 void
 GST_handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
-                         const struct GNUNET_MessageHeader *message)
+                             const struct GNUNET_MessageHeader *message)
 {
   const struct GNUNET_TESTBED_ControllerLinkRequest *msg;
-  struct GNUNET_CONFIGURATION_Handle *cfg;
   struct LCFContextQueue *lcfq;
   struct Route *route;
   struct Route *new_route;
   uint64_t op_id;
   uint32_t delegated_host_id;
   uint32_t slave_host_id;
-  uint16_t msize;
 
   if (NULL == GST_context)
   {
@@ -964,13 +962,6 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-  msize = ntohs (message->size);
-  if (sizeof (struct GNUNET_TESTBED_ControllerLinkRequest) >= msize)
-  {
-    GNUNET_break (0);
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    return;
-  }
   msg = (const struct GNUNET_TESTBED_ControllerLinkRequest *) message;
   delegated_host_id = ntohl (msg->delegated_host_id);
   if (delegated_host_id == GST_context->host_id)
@@ -1003,15 +994,6 @@
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
-  cfg = GNUNET_TESTBED_extract_config_ (message); /* destroy cfg here or in 
lcfcontext */
-  if (NULL == cfg)
-  {
-    GNUNET_break (0);         /* Configuration parsing error */
-    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-    return;
-  }
-  GNUNET_CONFIGURATION_destroy (cfg);
-  cfg = NULL;
   op_id = GNUNET_ntohll (msg->operation_id);
   if (slave_host_id == GST_context->host_id)    /* Link from us */
   {

Modified: gnunet/src/testbed/testbed.h
===================================================================
--- gnunet/src/testbed/testbed.h        2013-04-12 12:51:08 UTC (rev 26862)
+++ gnunet/src/testbed/testbed.h        2013-04-12 13:28:31 UTC (rev 26863)
@@ -190,19 +190,11 @@
   uint32_t slave_host_id GNUNET_PACKED;
 
   /**
-   * The size of the uncompressed configuration
-   */
-  uint16_t config_size GNUNET_PACKED;
-
-  /**
    * Set to 1 if the receiving controller is the master controller for
    * the slave host (and thus responsible for starting it?). 0 if not
    */
   uint8_t is_subordinate;
 
-  /* followed by serialized slave configuration;
-   * gzip'ed configuration file in INI format */
-
 };
 
 

Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c    2013-04-12 12:51:08 UTC (rev 26862)
+++ gnunet/src/testbed/testbed_api.c    2013-04-12 13:28:31 UTC (rev 26863)
@@ -1516,113 +1516,6 @@
 
 
 /**
- * Same as the GNUNET_TESTBED_controller_link_2, but with ids for delegated 
host
- * and slave host
- *
- * @param op_cls the operation closure for the event which is generated to
- *          signal success or failure of this operation
- * @param master handle to the master controller who creates the association
- * @param delegated_host_id id of the host to which requests should be 
delegated
- * @param slave_host_id id of the host which is used to run the slave 
controller
- * @param sxcfg serialized and compressed configuration
- * @param sxcfg_size the size sxcfg
- * @param scfg_size the size of uncompressed serialized configuration
- * @param is_subordinate GNUNET_YES if the controller at delegated_host should
- *          be started by the slave controller; GNUNET_NO if the slave
- *          controller has to connect to the already started delegated
- *          controller via TCP/IP
- * @return the operation handle
- */
-struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_controller_link_2_ (void *op_cls,
-                                   struct GNUNET_TESTBED_Controller *master,
-                                   uint32_t delegated_host_id,
-                                   uint32_t slave_host_id, const char *sxcfg,
-                                   size_t sxcfg_size, size_t scfg_size,
-                                   int is_subordinate)
-{
-  struct OperationContext *opc;
-  struct GNUNET_TESTBED_ControllerLinkRequest *msg;
-  struct ControllerLinkData *data;
-  uint16_t msg_size;
-
-  msg_size = sxcfg_size + sizeof (struct GNUNET_TESTBED_ControllerLinkRequest);
-  msg = GNUNET_malloc (msg_size);
-  msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS);
-  msg->header.size = htons (msg_size);
-  msg->delegated_host_id = htonl (delegated_host_id);
-  msg->slave_host_id = htonl (slave_host_id);
-  msg->config_size = htons ((uint16_t) scfg_size);
-  msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;
-  memcpy (&msg[1], sxcfg, sxcfg_size);
-  data = GNUNET_malloc (sizeof (struct ControllerLinkData));
-  data->msg = msg;
-  data->host_id = delegated_host_id;
-  opc = GNUNET_malloc (sizeof (struct OperationContext));
-  opc->c = master;
-  opc->data = data;
-  opc->type = OP_LINK_CONTROLLERS;
-  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
-  opc->state = OPC_STATE_INIT;
-  opc->op_cls = op_cls;
-  msg->operation_id = GNUNET_htonll (opc->id);
-  opc->op =
-      GNUNET_TESTBED_operation_create_ (opc, &opstart_link_controllers,
-                                        &oprelease_link_controllers);
-  GNUNET_TESTBED_operation_queue_insert_ (master->opq_parallel_operations,
-                                          opc->op);
-  GNUNET_TESTBED_operation_begin_wait_ (opc->op);
-  return opc->op;
-}
-
-
-/**
- * Same as the GNUNET_TESTBED_controller_link, however expects configuration in
- * serialized and compressed
- *
- * @param op_cls the operation closure for the event which is generated to
- *          signal success or failure of this operation
- * @param master handle to the master controller who creates the association
- * @param delegated_host requests to which host should be delegated; cannot be 
NULL
- * @param slave_host which host is used to run the slave controller; use NULL 
to
- *          make the master controller connect to the delegated host
- * @param sxcfg serialized and compressed configuration
- * @param sxcfg_size the size sxcfg
- * @param scfg_size the size of uncompressed serialized configuration
- * @param is_subordinate GNUNET_YES if the controller at delegated_host should
- *          be started by the slave controller; GNUNET_NO if the slave
- *          controller has to connect to the already started delegated
- *          controller via TCP/IP
- * @return the operation handle
- */
-struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_controller_link_2 (void *op_cls,
-                                  struct GNUNET_TESTBED_Controller *master,
-                                  struct GNUNET_TESTBED_Host *delegated_host,
-                                  struct GNUNET_TESTBED_Host *slave_host,
-                                  const char *sxcfg, size_t sxcfg_size,
-                                  size_t scfg_size, int is_subordinate)
-{
-  uint32_t delegated_host_id;
-  uint32_t slave_host_id;
-
-  GNUNET_assert (GNUNET_YES ==
-                 GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
-  delegated_host_id = GNUNET_TESTBED_host_get_id_ (delegated_host);
-  slave_host_id =
-      GNUNET_TESTBED_host_get_id_ ((NULL !=
-                                    slave_host) ? slave_host : master->host);
-  if ((NULL != slave_host) && (0 != GNUNET_TESTBED_host_get_id_ (slave_host)))
-    GNUNET_assert (GNUNET_YES ==
-                   GNUNET_TESTBED_is_host_registered_ (slave_host, master));
-
-  return GNUNET_TESTBED_controller_link_2_ (op_cls, master, delegated_host_id,
-                                            slave_host_id, sxcfg, sxcfg_size,
-                                            scfg_size, is_subordinate);
-}
-
-
-/**
  * Compresses given configuration using zlib compress
  *
  * @param config the serialized configuration
@@ -1671,54 +1564,6 @@
   *size = size_;
   *xsize = xsize_;
   return xconfig;
-}                             
-
-
-/**
- * Same as the GNUNET_TESTBED_controller_link, but with ids for delegated host
- * and slave host
- *
- * @param op_cls the operation closure for the event which is generated to
- *          signal success or failure of this operation
- * @param master handle to the master controller who creates the association
- * @param delegated_host_id id of the host to which requests should be
- *          delegated; cannot be NULL
- * @param slave_host_id id of the host which should connect to controller
- *          running on delegated host ; use NULL to make the master controller
- *          connect to the delegated host
- * @param slave_cfg configuration to use for the slave controller
- * @param is_subordinate GNUNET_YES if the controller at delegated_host should
- *          be started by the slave controller; GNUNET_NO if the slave
- *          controller has to connect to the already started delegated
- *          controller via TCP/IP
- * @return the operation handle
- */
-struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_controller_link_ (void *op_cls,
-                                 struct GNUNET_TESTBED_Controller *master,
-                                 uint32_t delegated_host_id,
-                                 uint32_t slave_host_id,
-                                 const struct GNUNET_CONFIGURATION_Handle
-                                 *slave_cfg, int is_subordinate)
-{
-  struct GNUNET_TESTBED_Operation *op;
-  char *config;
-  char *cconfig;
-  size_t cc_size;
-  size_t config_size;
-
-  config = GNUNET_CONFIGURATION_serialize (slave_cfg, &config_size);
-  cc_size = GNUNET_TESTBED_compress_config_ (config, config_size, &cconfig);
-  GNUNET_free (config);
-  /* Configuration doesn't fit in 1 message */
-  GNUNET_assert ((UINT16_MAX -
-                  sizeof (struct GNUNET_TESTBED_ControllerLinkRequest)) >=
-                 cc_size);
-  op = GNUNET_TESTBED_controller_link_2_ (op_cls, master, delegated_host_id,
-                                          slave_host_id, (const char *) 
cconfig,
-                                          cc_size, config_size, 
is_subordinate);
-  GNUNET_free (cconfig);
-  return op;
 }
 
 
@@ -1759,8 +1604,12 @@
                                 const struct GNUNET_CONFIGURATION_Handle
                                 *slave_cfg, int is_subordinate)
 {
+  struct OperationContext *opc;
+  struct GNUNET_TESTBED_ControllerLinkRequest *msg;
+  struct ControllerLinkData *data;
   uint32_t slave_host_id;
   uint32_t delegated_host_id;
+  uint16_t msg_size;
   
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
@@ -1771,11 +1620,30 @@
   if ((NULL != slave_host) && (0 != slave_host_id))
     GNUNET_assert (GNUNET_YES ==
                    GNUNET_TESTBED_is_host_registered_ (slave_host, master));
-  return GNUNET_TESTBED_controller_link_ (op_cls, master, delegated_host_id,
-                                          slave_host_id,
-                                          GNUNET_TESTBED_host_get_cfg_ 
(delegated_host),
-                                          is_subordinate);
-
+  msg_size = sizeof (struct GNUNET_TESTBED_ControllerLinkRequest);
+  msg = GNUNET_malloc (msg_size);
+  msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS);
+  msg->header.size = htons (msg_size);
+  msg->delegated_host_id = htonl (delegated_host_id);
+  msg->slave_host_id = htonl (slave_host_id);
+  msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;data = 
GNUNET_malloc (sizeof (struct ControllerLinkData));
+  data->msg = msg;
+  data->host_id = delegated_host_id;
+  opc = GNUNET_malloc (sizeof (struct OperationContext));
+  opc->c = master;
+  opc->data = data;
+  opc->type = OP_LINK_CONTROLLERS;
+  opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
+  opc->state = OPC_STATE_INIT;
+  opc->op_cls = op_cls;
+  msg->operation_id = GNUNET_htonll (opc->id);
+  opc->op =
+      GNUNET_TESTBED_operation_create_ (opc, &opstart_link_controllers,
+                                        &oprelease_link_controllers);
+  GNUNET_TESTBED_operation_queue_insert_ (master->opq_parallel_operations,
+                                          opc->op);
+  GNUNET_TESTBED_operation_begin_wait_ (opc->op);
+  return opc->op;
 }
 
 
@@ -2009,16 +1877,6 @@
       xdata = (const Bytef *) &imsg[1];
     }
     break;
-  case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS:
-    {
-      const struct GNUNET_TESTBED_ControllerLinkRequest *imsg;
-      imsg = (const struct GNUNET_TESTBED_ControllerLinkRequest *) msg;
-      data_len = ntohs (imsg->config_size);
-      xdata_len = ntohs (imsg->header.size) - sizeof (const struct
-      GNUNET_TESTBED_ControllerLinkRequest);
-      xdata = (const Bytef *) &imsg[1];
-    }
-    break;
   default:
     GNUNET_assert (0);
   }




reply via email to

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