gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r25984 - gnunet/src/testbed
Date: Fri, 1 Feb 2013 21:23:01 +0100

Author: harsha
Date: 2013-02-01 21:23:00 +0100 (Fri, 01 Feb 2013)
New Revision: 25984

Modified:
   gnunet/src/testbed/gnunet-service-testbed.c
   gnunet/src/testbed/gnunet-service-testbed.h
   gnunet/src/testbed/gnunet-service-testbed_cache.c
   gnunet/src/testbed/gnunet-service-testbed_oc.c
   gnunet/src/testbed/testbed_api_testbed.c
Log:
- doc & indent

Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2013-02-01 18:09:57 UTC (rev 
25983)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2013-02-01 20:23:00 UTC (rev 
25984)
@@ -2190,8 +2190,7 @@
   }
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED",
-                                                        "CACHE_SIZE",
-                                                        &num));
+                                                        "CACHE_SIZE", &num));
   GST_cache_init ((unsigned int) num);
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED",

Modified: gnunet/src/testbed/gnunet-service-testbed.h
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.h 2013-02-01 18:09:57 UTC (rev 
25983)
+++ gnunet/src/testbed/gnunet-service-testbed.h 2013-02-01 20:23:00 UTC (rev 
25984)
@@ -817,10 +817,10 @@
  *          cases, its value being NULL means that CORE connection has failed.
  */
 typedef void (*GST_cache_handle_ready_cb) (void *cls,
-                                           struct GNUNET_CORE_Handle *ch, 
-                                           struct GNUNET_TRANSPORT_Handle *th,
-                                           const struct 
-                                           GNUNET_PeerIdentity *peer_id);
+                                           struct GNUNET_CORE_Handle * ch,
+                                           struct GNUNET_TRANSPORT_Handle * th,
+                                           const struct GNUNET_PeerIdentity *
+                                           peer_id);
 
 
 /**
@@ -836,7 +836,8 @@
  *          valid until GST_cache_get_handle_done() is called.
  */
 typedef void (*GST_cache_peer_connect_notify) (void *cls,
-                                               const struct 
GNUNET_PeerIdentity *target);
+                                               const struct GNUNET_PeerIdentity
+                                               * target);
 
 
 /**
@@ -862,8 +863,7 @@
 struct GSTCacheGetHandle *
 GST_cache_get_handle_transport (unsigned int peer_id,
                                 const struct GNUNET_CONFIGURATION_Handle *cfg,
-                                GST_cache_handle_ready_cb cb,
-                                void *cb_cls,
+                                GST_cache_handle_ready_cb cb, void *cb_cls,
                                 const struct GNUNET_PeerIdentity *target,
                                 GST_cache_peer_connect_notify 
connect_notify_cb,
                                 void *connect_notify_cb_cls);
@@ -893,8 +893,7 @@
 struct GSTCacheGetHandle *
 GST_cache_get_handle_core (unsigned int peer_id,
                            const struct GNUNET_CONFIGURATION_Handle *cfg,
-                           GST_cache_handle_ready_cb cb,
-                           void *cb_cls,
+                           GST_cache_handle_ready_cb cb, void *cb_cls,
                            const struct GNUNET_PeerIdentity *target,
                            GST_cache_peer_connect_notify connect_notify_cb,
                            void *connect_notify_cb_cls);

Modified: gnunet/src/testbed/gnunet-service-testbed_cache.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_cache.c   2013-02-01 18:09:57 UTC 
(rev 25983)
+++ gnunet/src/testbed/gnunet-service-testbed_cache.c   2013-02-01 20:23:00 UTC 
(rev 25984)
@@ -117,12 +117,12 @@
    * The cache entry object this handle corresponds to
    */
   struct CacheEntry *entry;
-  
+
   /**
    * The cache callback to call when a handle is available
    */
   GST_cache_handle_ready_cb cb;
-   
+
   /**
    * The closure for the above callback
    */
@@ -130,7 +130,7 @@
 
   /**
    * The peer connect notify context created for this handle; can be NULL
-   */  
+   */
   struct ConnectNotifyContext *nctxt;
 
   /**
@@ -147,7 +147,7 @@
 /**
  * Cache entry
  */
-struct CacheEntry 
+struct CacheEntry
 {
   /**
    * DLL next ptr for least recently used cache entries
@@ -312,7 +312,7 @@
 close_handles (struct CacheEntry *entry)
 {
   struct ConnectNotifyContext *ctxt;
-  
+
   GNUNET_assert (0 == entry->demand);
   if (GNUNET_YES == entry->in_lru)
   {
@@ -363,8 +363,7 @@
   entry->peer_id = peer_id;
   memcpy (&entry->key, key, sizeof (struct GNUNET_HashCode));
   GNUNET_assert (GNUNET_OK ==
-                 GNUNET_CONTAINER_multihashmap_put (cache, &entry->key,
-                                                    entry,
+                 GNUNET_CONTAINER_multihashmap_put (cache, &entry->key, entry,
                                                     
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST));
   cache_size++;
   return entry;
@@ -388,7 +387,7 @@
 {
   const struct GSTCacheGetHandle *cgh;
 
-  for (cgh=head; NULL != cgh; cgh=cgh->next)
+  for (cgh = head; NULL != cgh; cgh = cgh->next)
   {
     if (GNUNET_YES == cgh->notify_called)
       return NULL;
@@ -404,7 +403,7 @@
       break;
     }
     break;
-  }  
+  }
   return (struct GSTCacheGetHandle *) cgh;
 }
 
@@ -422,7 +421,7 @@
   struct CacheEntry *entry = cls;
   struct GSTCacheGetHandle *cgh;
   const struct GSTCacheGetHandle *cgh2;
-  
+
   GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != entry->notify_task);
   entry->notify_task = GNUNET_SCHEDULER_NO_TASK;
   cgh = search_suitable_cgh (entry, entry->cgh_qhead);
@@ -436,13 +435,13 @@
   if (NULL != cgh2)
     entry->notify_task = GNUNET_SCHEDULER_add_now (&call_cgh_cb, entry);
   if (NULL != cgh->nctxt)
-  {/* Register the peer connect notify callback */
+  {                             /* Register the peer connect notify callback */
     GNUNET_CONTAINER_DLL_insert_tail (entry->nctxt_qhead, entry->nctxt_qtail,
                                       cgh->nctxt);
   }
   LOG_DEBUG ("Calling notify for handle type %u\n", cgh->type);
-  cgh->cb (cgh->cb_cls, entry->core_handle, 
-           entry->transport_handle_, entry->peer_identity);
+  cgh->cb (cgh->cb_cls, entry->core_handle, entry->transport_handle_,
+           entry->peer_identity);
 }
 
 
@@ -455,9 +454,8 @@
  * @param peer the peer that connected
  * @param type the type of the handle this notification corresponds to
  */
-static void 
-peer_connect_notify_cb (void *cls,
-                        const struct GNUNET_PeerIdentity *peer,
+static void
+peer_connect_notify_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
                         const enum CacheGetType type)
 {
   struct CacheEntry *entry = cls;
@@ -466,8 +464,8 @@
   GST_cache_peer_connect_notify cb;
   void *cb_cls;
 
-  
-  for (ctxt=entry->nctxt_qhead; NULL != ctxt;)
+
+  for (ctxt = entry->nctxt_qhead; NULL != ctxt;)
   {
     GNUNET_assert (NULL != ctxt->cgh);
     if (type != ctxt->cgh->type)
@@ -487,11 +485,11 @@
     GNUNET_CONTAINER_DLL_remove (entry->nctxt_qhead, entry->nctxt_qtail, ctxt);
     GNUNET_free (ctxt);
     ctxt = ctxt2;
-    cb (cb_cls, peer);  
+    cb (cb_cls, peer);
   }
   if (NULL == ctxt)
     return;
-  
+
 }
 
 
@@ -504,7 +502,7 @@
  * @param ats performance data
  * @param ats_count number of entries in ats (excluding 0-termination)
  */
-static void 
+static void
 transport_peer_connect_notify_cb (void *cls,
                                   const struct GNUNET_PeerIdentity *peer,
                                   const struct GNUNET_ATS_Information *ats,
@@ -527,10 +525,8 @@
 
   GNUNET_assert (NULL != entry);
   LOG_DEBUG ("Opening a transport connection to peer %u\n", entry->peer_id);
-  entry->transport_handle_ = 
-      GNUNET_TRANSPORT_connect (entry->cfg,
-                                NULL, entry,
-                                NULL,
+  entry->transport_handle_ =
+      GNUNET_TRANSPORT_connect (entry->cfg, NULL, entry, NULL,
                                 &transport_peer_connect_notify_cb, NULL);
   if (NULL == entry->transport_handle_)
   {
@@ -556,7 +552,7 @@
 oprelease_get_handle_transport (void *cls)
 {
   struct CacheEntry *entry = cls;
-  
+
   if (NULL == entry->transport_handle_)
     return;
   GNUNET_TRANSPORT_disconnect (entry->transport_handle_);
@@ -577,9 +573,8 @@
  * @param server handle to the server, NULL if we failed
  * @param my_identity ID of this peer, NULL if we failed
  */
-static void 
-core_startup_cb (void *cls,
-                 struct GNUNET_CORE_Handle * server,
+static void
+core_startup_cb (void *cls, struct GNUNET_CORE_Handle *server,
                  const struct GNUNET_PeerIdentity *my_identity)
 {
   struct CacheEntry *entry = cls;
@@ -595,7 +590,7 @@
   memcpy (entry->peer_identity, my_identity,
           sizeof (struct GNUNET_PeerIdentity));
   if (0 == entry->demand)
-    return;  
+    return;
   if (GNUNET_SCHEDULER_NO_TASK != entry->notify_task)
     return;
   if (NULL != search_suitable_cgh (entry, entry->cgh_qhead))
@@ -611,12 +606,11 @@
  * @param atsi performance data for the connection
  * @param atsi_count number of records in 'atsi'
  */
-static void 
-core_peer_connect_cb (void *cls,
-                      const struct GNUNET_PeerIdentity * peer,
-                      const struct GNUNET_ATS_Information * atsi,
+static void
+core_peer_connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
+                      const struct GNUNET_ATS_Information *atsi,
                       unsigned int atsi_count)
-{  
+{
   peer_connect_notify_cb (cls, peer, CGT_CORE_HANDLE);
 }
 
@@ -631,6 +625,7 @@
 opstart_get_handle_core (void *cls)
 {
   struct CacheEntry *entry = cls;
+
   const struct GNUNET_CORE_MessageHandler no_handlers[] = {
     {NULL, 0, 0}
   };
@@ -638,17 +633,15 @@
   GNUNET_assert (NULL != entry);
   LOG_DEBUG ("Opening a CORE connection to peer %u\n", entry->peer_id);
   /* void?: We also get the handle when the connection to CORE is successful */
-  (void) GNUNET_CORE_connect (entry->cfg,
-                              entry,
-                              &core_startup_cb,
-                              &core_peer_connect_cb,
-                              NULL, /* disconnect cb */
-                              NULL, /* inbound notify */
-                              GNUNET_NO,
-                              NULL, /* outbound notify */
-                              GNUNET_NO,
+  (void) GNUNET_CORE_connect (entry->cfg, entry,        /* closure */
+                              &core_startup_cb, /* core startup notify */
+                              &core_peer_connect_cb,    /* peer connect notify 
*/
+                              NULL,     /* peer disconnect notify */
+                              NULL,     /* inbound notify */
+                              GNUNET_NO,        /* inbound header only? */
+                              NULL,     /* outbound notify */
+                              GNUNET_NO,        /* outbound header only? */
                               no_handlers);
-  //GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == entry->notify_task);
 }
 
 
@@ -662,7 +655,7 @@
 oprelease_get_handle_core (void *cls)
 {
   struct CacheEntry *entry = cls;
-  
+
   if (NULL == entry->core_handle)
     return;
   GNUNET_CORE_disconnect (entry->core_handle);
@@ -682,8 +675,7 @@
  * @param cls the cache entry
  */
 static struct GSTCacheGetHandle *
-cache_get_handle (unsigned int peer_id,
-                  struct GSTCacheGetHandle *cgh,
+cache_get_handle (unsigned int peer_id, struct GSTCacheGetHandle *cgh,
                   const struct GNUNET_CONFIGURATION_Handle *cfg,
                   const struct GNUNET_PeerIdentity *target,
                   GST_cache_peer_connect_notify connect_notify_cb,
@@ -714,7 +706,8 @@
     case CGT_TRANSPORT_HANDLE:
       handle = entry->transport_handle_;
       if (NULL != handle)
-        LOG_DEBUG ("Found TRANSPORT handle in cache for peer %u\n", 
entry->peer_id);
+        LOG_DEBUG ("Found TRANSPORT handle in cache for peer %u\n",
+                   entry->peer_id);
       break;
     case CGT_CORE_HANDLE:
       handle = entry->core_handle;
@@ -780,9 +773,7 @@
  *         GNUNET_NO if not.
  */
 static int
-cache_clear_iterator (void *cls,
-                      const struct GNUNET_HashCode * key,
-                      void *value)
+cache_clear_iterator (void *cls, const struct GNUNET_HashCode *key, void 
*value)
 {
   struct CacheEntry *entry = value;
   static unsigned int ncleared;
@@ -862,12 +853,13 @@
   {
     GNUNET_assert (cgh == cgh->nctxt->cgh);
     if (GNUNET_YES == cgh->notify_called)
-      GNUNET_CONTAINER_DLL_remove (entry->nctxt_qhead, entry->nctxt_qtail, 
cgh->nctxt);
+      GNUNET_CONTAINER_DLL_remove (entry->nctxt_qhead, entry->nctxt_qtail,
+                                   cgh->nctxt);
     GNUNET_free (cgh->nctxt);
   }
-  GNUNET_free (cgh);  
+  GNUNET_free (cgh);
   if (0 == entry->demand)
-  {    
+  {
     GNUNET_CONTAINER_DLL_insert_tail (lru_cache_head, lru_cache_tail, entry);
     lru_cache_size++;
     entry->in_lru = GNUNET_YES;
@@ -907,8 +899,7 @@
 struct GSTCacheGetHandle *
 GST_cache_get_handle_transport (unsigned int peer_id,
                                 const struct GNUNET_CONFIGURATION_Handle *cfg,
-                                GST_cache_handle_ready_cb cb,
-                                void *cb_cls,
+                                GST_cache_handle_ready_cb cb, void *cb_cls,
                                 const struct GNUNET_PeerIdentity *target,
                                 GST_cache_peer_connect_notify 
connect_notify_cb,
                                 void *connect_notify_cb_cls)
@@ -919,8 +910,8 @@
   cgh->cb = cb;
   cgh->cb_cls = cb_cls;
   cgh->type = CGT_TRANSPORT_HANDLE;
-  return cache_get_handle (peer_id, cgh, cfg,
-                           target, connect_notify_cb, connect_notify_cb_cls);
+  return cache_get_handle (peer_id, cgh, cfg, target, connect_notify_cb,
+                           connect_notify_cb_cls);
 }
 
 
@@ -948,8 +939,7 @@
 struct GSTCacheGetHandle *
 GST_cache_get_handle_core (unsigned int peer_id,
                            const struct GNUNET_CONFIGURATION_Handle *cfg,
-                           GST_cache_handle_ready_cb cb,
-                           void *cb_cls,
+                           GST_cache_handle_ready_cb cb, void *cb_cls,
                            const struct GNUNET_PeerIdentity *target,
                            GST_cache_peer_connect_notify connect_notify_cb,
                            void *connect_notify_cb_cls)
@@ -960,8 +950,8 @@
   cgh->cb = cb;
   cgh->cb_cls = cb_cls;
   cgh->type = CGT_CORE_HANDLE;
-  return cache_get_handle (peer_id, cgh, cfg,
-                           target, connect_notify_cb, connect_notify_cb_cls);
+  return cache_get_handle (peer_id, cgh, cfg, target, connect_notify_cb,
+                           connect_notify_cb_cls);
 }
 
 
@@ -976,7 +966,7 @@
 {
   struct CacheEntry *entry;
   struct GNUNET_HashCode key;
-  
+
   LOG_DEBUG ("Looking up HELLO for peer %u\n", peer_id);
   GNUNET_CRYPTO_hash (&peer_id, sizeof (peer_id), &key);
   entry = cache_lookup (&key);

Modified: gnunet/src/testbed/gnunet-service-testbed_oc.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed_oc.c      2013-02-01 18:09:57 UTC 
(rev 25983)
+++ gnunet/src/testbed/gnunet-service-testbed_oc.c      2013-02-01 20:23:00 UTC 
(rev 25984)
@@ -37,7 +37,7 @@
 
 
 /**
- * Context information for transport try connect
+ * Context information for requesting TRANSPORT to connect to a peer
  */
 struct TryConnectContext
 {
@@ -47,7 +47,7 @@
   struct GNUNET_PeerIdentity *pid;
 
   /**
-   * The transport handle
+   * The transport handle obtained from cache. Do NOT close/disconnect.
    */
   struct GNUNET_TRANSPORT_Handle *th_;
 
@@ -80,32 +80,34 @@
 
 
 /**
- * Context information for connecting 2 peers in overlay
+ * Context information for connecting 2 peers in overlay.
  */
 struct OverlayConnectContext
 {
   /**
-   * The next pointer for maintaining a DLL
+   * The next pointer for maintaining a DLL of all OverlayConnectContexts
    */
   struct OverlayConnectContext *next;
 
   /**
-   * The prev pointer for maintaining a DLL
+   * The prev pointer for maintaining a DLL of all OverlayConnectContexts
    */
   struct OverlayConnectContext *prev;
 
   /**
-   * The client which has requested for overlay connection
+   * The client which has requested for overlay connection. This is used to 
send
+   * either a success of failure message
    */
   struct GNUNET_SERVER_Client *client;
 
   /**
-   * the peer which has to connect to the other peer
+   * the first peer which is to expect an overlay connection from the second 
peer.
    */
   struct Peer *peer;
 
   /**
-   * Transport handle of the first peer to get its HELLO
+   * Transport handle of the first peer obtained from cache to get its HELLO. 
Do
+   * NOT close/disconnect.
    */
   struct GNUNET_TRANSPORT_Handle *p1th_;
 
@@ -115,27 +117,24 @@
   struct GSTCacheGetHandle *cgh_p1th;
 
   /**
-   * Core handles of the first peer; used to notify when second peer connects 
to it
+   * The GetCacheHandle for registering callback to notify CORE level peer
+   * connects and to get our identity.
    */
-  //struct GNUNET_CORE_Handle *ch_;
-
-  /**
-   * The GetCacheHandle for the p1th transport handle
-   */
   struct GSTCacheGetHandle *cgh_ch;
 
   /**
-   * HELLO of the other peer
+   * HELLO of the first peer.  This should be sent to the second peer.
    */
   struct GNUNET_MessageHeader *hello;
 
   /**
-   * Get hello handle to acquire HELLO of first peer
+   * Get GetHelloHandle to acquire a HELLO of the first peer
    */
   struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
 
   /**
-   * The handle for offering HELLO
+   * The handle for offering the HELLO of the first peer to the second
+   * peer. This is only used if the second peer is a local peer.
    */
   struct GNUNET_TRANSPORT_OfferHelloHandle *ohh;
 
@@ -145,17 +144,19 @@
   char *emsg;
 
   /**
-   * Operation context for suboperations
+   * Operation context for the suboperation we start to get the identity of the
+   * second peer if it is a remote peer
    */
   struct OperationContext *opc;
 
   /**
-   * Controller of peer 2; NULL if the peer is local
+   * Controller of peer 2; NULL if the peer is a local peer
    */
   struct GNUNET_TESTBED_Controller *peer2_controller;
 
   /**
-   * The transport try connect context
+   * The transport TryConnectContext. This will be NULL if the second peer is a
+   * remote peer
    */
   struct TryConnectContext tcc;
 
@@ -204,10 +205,11 @@
 
 
 /**
- * Context information for RequestOverlayConnect
- * operations. RequestOverlayConnect is used when peers A, B reside on 
different
- * hosts and the host controller for peer B is asked by the host controller of
- * peer A to make peer B connect to peer A
+ * Context information for remote overlay connect operations.  Remote overlay
+ * connections are used when peers A and B reside on different hosts.  In these
+ * operations the host controller for peer B is asked by the host controller of
+ * peer A to make peer B connect to peer A by sending the controller of peer B
+ * the HELLO of peer A.
  */
 struct RemoteOverlayConnectCtx
 {
@@ -505,8 +507,7 @@
  * @param new_peer the peer that connected
  */
 static void
-overlay_connect_notify (void *cls,
-                        const struct GNUNET_PeerIdentity *new_peer)
+overlay_connect_notify (void *cls, const struct GNUNET_PeerIdentity *new_peer)
 {
   struct OverlayConnectContext *occ = cls;
   char *new_peer_str;
@@ -729,8 +730,8 @@
  * @param th the handle to TRANSPORT. Can be NULL if it is not requested
  * @param ignore_ peer identity which is ignored in this callback
  */
-static void 
-p2_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, 
+static void
+p2_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch,
                                      struct GNUNET_TRANSPORT_Handle *th,
                                      const struct GNUNET_PeerIdentity *ignore_)
 {
@@ -769,13 +770,12 @@
   if (NULL == occ->peer2_controller)
   {
     GST_peer_list[occ->other_peer_id]->reference_cnt++;
-    occ->tcc.cgh_th = 
+    occ->tcc.cgh_th =
         GST_cache_get_handle_transport (occ->other_peer_id,
                                         GST_peer_list[occ->other_peer_id]->
                                         details.local.cfg,
                                         &p2_transport_connect_cache_callback,
-                                        occ,
-                                        NULL, NULL, NULL);
+                                        occ, NULL, NULL, NULL);
     return;
   }
   GNUNET_asprintf (&occ->emsg, "0x%llx: Timeout while offering HELLO to %s",
@@ -854,8 +854,8 @@
  * @param th the handle to TRANSPORT. Can be NULL if it is not requested
  * @param ignore_ peer identity which is ignored in this callback
  */
-static void 
-p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, 
+static void
+p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch,
                                      struct GNUNET_TRANSPORT_Handle *th,
                                      const struct GNUNET_PeerIdentity *ignore_)
 {
@@ -890,8 +890,8 @@
  * @param th the handle to TRANSPORT. Can be NULL if it is not requested
  * @param my_identity the identity of our peer
  */
-static void 
-occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, 
+static void
+occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch,
                               struct GNUNET_TRANSPORT_Handle *th,
                               const struct GNUNET_PeerIdentity *my_identity)
 {
@@ -906,12 +906,13 @@
                             "0x%llx: Failed to connect to CORE of peer with"
                             "id: %u", occ->op_id, occ->peer_id);
     GNUNET_SCHEDULER_cancel (occ->timeout_task);
-    occ->timeout_task = GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, 
occ);
+    occ->timeout_task =
+        GNUNET_SCHEDULER_add_now (&timeout_overlay_connect, occ);
     return;
   }
   //occ->ch_ = ch;
   occ->emsg = NULL;
-  if (GNUNET_YES == 
+  if (GNUNET_YES ==
       GNUNET_CORE_is_peer_connected_sync (ch, &occ->other_peer_identity))
   {
     LOG_DEBUG ("0x%llx: Target peer already connected\n", occ->op_id);
@@ -920,7 +921,7 @@
     send_overlay_connect_success_msg (occ);
     occ->cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup_occ, occ);
     return;
-  }  
+  }
   memcpy (&occ->peer_identity, my_identity,
           sizeof (struct GNUNET_PeerIdentity));
   LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n", occ->op_id,
@@ -938,11 +939,10 @@
                    "0x%llx: Timeout while acquiring TRANSPORT of %s from 
cache",
                    occ->op_id, GNUNET_i2s (&occ->peer_identity));
   occ->peer->reference_cnt++;
-  occ->cgh_p1th = 
+  occ->cgh_p1th =
       GST_cache_get_handle_transport (occ->peer_id,
                                       occ->peer->details.local.cfg,
-                                      p1_transport_connect_cache_callback,
-                                      occ,
+                                      p1_transport_connect_cache_callback, occ,
                                       NULL, NULL, NULL);
   return;
 }
@@ -979,13 +979,11 @@
                    "0x%llx: Timeout while connecting to CORE of peer with "
                    "id: %u", occ->op_id, occ->peer_id);
   occ->peer->reference_cnt++;
-  occ->cgh_ch = GST_cache_get_handle_core (occ->peer_id,
-                                           occ->peer->details.local.cfg,
-                                           occ_cache_get_handle_core_cb,
-                                           occ,
-                                           &occ->other_peer_identity,
-                                           &overlay_connect_notify,
-                                           occ);
+  occ->cgh_ch =
+      GST_cache_get_handle_core (occ->peer_id, occ->peer->details.local.cfg,
+                                 occ_cache_get_handle_core_cb, occ,
+                                 &occ->other_peer_identity,
+                                 &overlay_connect_notify, occ);
   return;
 }
 
@@ -1296,13 +1294,11 @@
                    "0x%llx: Timeout while connecting to CORE of peer with "
                    "id: %u", occ->op_id, occ->peer_id);
   occ->peer->reference_cnt++;
-  occ->cgh_ch = GST_cache_get_handle_core (occ->peer_id,
-                                           occ->peer->details.local.cfg,
-                                           occ_cache_get_handle_core_cb,
-                                           occ,
-                                           &occ->other_peer_identity,
-                                           &overlay_connect_notify,
-                                           occ);
+  occ->cgh_ch =
+      GST_cache_get_handle_core (occ->peer_id, occ->peer->details.local.cfg,
+                                 occ_cache_get_handle_core_cb, occ,
+                                 &occ->other_peer_identity,
+                                 &overlay_connect_notify, occ);
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 
@@ -1367,13 +1363,15 @@
  * @param ats_count number of entries in ats (excluding 0-termination)
  */
 static void
-cache_transport_peer_connect_notify (void *cls, 
+cache_transport_peer_connect_notify (void *cls,
                                      const struct GNUNET_PeerIdentity 
*new_peer)
 {
   struct RemoteOverlayConnectCtx *rocc = cls;
 
   LOG_DEBUG ("0x%llx: Request Overlay connect notify\n", rocc->op_id);
-  GNUNET_assert (0 == memcmp (new_peer, &rocc->a_id, sizeof (struct 
GNUNET_PeerIdentity)));
+  GNUNET_assert (0 ==
+                 memcmp (new_peer, &rocc->a_id,
+                         sizeof (struct GNUNET_PeerIdentity)));
   LOG_DEBUG ("0x%llx: Peer %4s connected\n", rocc->op_id,
              GNUNET_i2s (&rocc->a_id));
   cleanup_rocc (rocc);
@@ -1459,13 +1457,13 @@
  * @param th the handle to TRANSPORT. Can be NULL if it is not requested
  * @param ignore_ peer identity which is ignored in this callback
  */
-static void 
-rocc_cache_get_handle_transport_cb (void *cls, struct GNUNET_CORE_Handle *ch, 
+static void
+rocc_cache_get_handle_transport_cb (void *cls, struct GNUNET_CORE_Handle *ch,
                                     struct GNUNET_TRANSPORT_Handle *th,
                                     const struct GNUNET_PeerIdentity *ignore_)
 {
   struct RemoteOverlayConnectCtx *rocc = cls;
-  
+
   if (NULL == th)
   {
     rocc->timeout_rocc_task_id =
@@ -1474,8 +1472,8 @@
   }
   rocc->tcc.th_ = th;
   rocc->tcc.pid = &rocc->a_id;
-  if (GNUNET_YES == GNUNET_TRANSPORT_check_neighbour_connected (rocc->tcc.th_,
-                                                                rocc->tcc.pid))
+  if (GNUNET_YES ==
+      GNUNET_TRANSPORT_check_neighbour_connected (rocc->tcc.th_, 
rocc->tcc.pid))
   {
     LOG_DEBUG ("0x%llx: Target peer %4s already connected to local peer: %u\n",
                rocc->op_id, GNUNET_i2s (&rocc->a_id), rocc->peer->id);
@@ -1483,7 +1481,7 @@
     return;
   }
   rocc->attempt_connect_task_id =
-      GNUNET_SCHEDULER_add_now (&attempt_connect_task, rocc);  
+      GNUNET_SCHEDULER_add_now (&attempt_connect_task, rocc);
 }
 
 
@@ -1559,11 +1557,9 @@
   rocc->peer->reference_cnt++;
   rocc->hello = GNUNET_malloc (hsize);
   memcpy (rocc->hello, msg->hello, hsize);
-  rocc->tcc.cgh_th = 
-      GST_cache_get_handle_transport (peer_id,
-                                      rocc->peer->details.local.cfg,
-                                      &rocc_cache_get_handle_transport_cb,
-                                      rocc, 
+  rocc->tcc.cgh_th =
+      GST_cache_get_handle_transport (peer_id, rocc->peer->details.local.cfg,
+                                      &rocc_cache_get_handle_transport_cb, 
rocc,
                                       &rocc->a_id,
                                       &cache_transport_peer_connect_notify,
                                       rocc);

Modified: gnunet/src/testbed/testbed_api_testbed.c
===================================================================
--- gnunet/src/testbed/testbed_api_testbed.c    2013-02-01 18:09:57 UTC (rev 
25983)
+++ gnunet/src/testbed/testbed_api_testbed.c    2013-02-01 20:23:00 UTC (rev 
25984)
@@ -973,10 +973,10 @@
   if (0 < rc->num_hosts)
   {
     old_hosts = rc->hosts;
-    rc->hosts = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) 
-                               * rc->num_hosts);
-    memcpy (rc->hosts, &old_hosts[1], (sizeof (struct GNUNET_TESTBED_Host *)
-                                       * rc->num_hosts));
+    rc->hosts =
+        GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * rc->num_hosts);
+    memcpy (rc->hosts, &old_hosts[1],
+            (sizeof (struct GNUNET_TESTBED_Host *) * rc->num_hosts));
     GNUNET_free (old_hosts);
   }
   else




reply via email to

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