diff options
author | harsha <harsha@140774ce-b5e7-0310-ab8b-a85725594a96> | 2013-02-01 20:23:00 +0000 |
---|---|---|
committer | harsha <harsha@140774ce-b5e7-0310-ab8b-a85725594a96> | 2013-02-01 20:23:00 +0000 |
commit | 2b422c6c60967022b96f97c9a6ca3a7a3ae96b9f (patch) | |
tree | e300a0db7b8c3c947d2f151fb8709df18f3bbde5 | |
parent | ad88fa87a12d0c83af46a677a4d5be1e78d15222 (diff) |
- doc & indent
git-svn-id: https://gnunet.org/svn/gnunet@25984 140774ce-b5e7-0310-ab8b-a85725594a96
-rw-r--r-- | src/testbed/gnunet-service-testbed.c | 3 | ||||
-rw-r--r-- | src/testbed/gnunet-service-testbed.h | 17 | ||||
-rw-r--r-- | src/testbed/gnunet-service-testbed_cache.c | 118 | ||||
-rw-r--r-- | src/testbed/gnunet-service-testbed_oc.c | 132 | ||||
-rw-r--r-- | src/testbed/testbed_api_testbed.c | 8 |
5 files changed, 131 insertions, 147 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c index 8fc512c131..f1dc3fab99 100644 --- a/src/testbed/gnunet-service-testbed.c +++ b/src/testbed/gnunet-service-testbed.c @@ -2190,8 +2190,7 @@ testbed_run (void *cls, struct GNUNET_SERVER_Handle *server, } 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", diff --git a/src/testbed/gnunet-service-testbed.h b/src/testbed/gnunet-service-testbed.h index 7314122d32..ebf3c66f92 100644 --- a/src/testbed/gnunet-service-testbed.h +++ b/src/testbed/gnunet-service-testbed.h @@ -817,10 +817,10 @@ GST_cache_add_hello (const unsigned int peer_id, * 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 @@ typedef void (*GST_cache_handle_ready_cb) (void *cls, * 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 @@ typedef void (*GST_cache_peer_connect_notify) (void *cls, 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 @@ GST_cache_get_handle_transport (unsigned int peer_id, 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); diff --git a/src/testbed/gnunet-service-testbed_cache.c b/src/testbed/gnunet-service-testbed_cache.c index 9e65db9e8c..46c7d4fce3 100644 --- a/src/testbed/gnunet-service-testbed_cache.c +++ b/src/testbed/gnunet-service-testbed_cache.c @@ -117,12 +117,12 @@ struct GSTCacheGetHandle * 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 @@ struct GSTCacheGetHandle /** * The peer connect notify context created for this handle; can be NULL - */ + */ struct ConnectNotifyContext *nctxt; /** @@ -147,7 +147,7 @@ struct GSTCacheGetHandle /** * Cache entry */ -struct CacheEntry +struct CacheEntry { /** * DLL next ptr for least recently used cache entries @@ -312,7 +312,7 @@ static void close_handles (struct CacheEntry *entry) { struct ConnectNotifyContext *ctxt; - + GNUNET_assert (0 == entry->demand); if (GNUNET_YES == entry->in_lru) { @@ -363,8 +363,7 @@ add_entry (const struct GNUNET_HashCode *key, unsigned int peer_id) 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 @@ search_suitable_cgh (const struct CacheEntry *entry, { 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 @@ search_suitable_cgh (const struct CacheEntry *entry, break; } break; - } + } return (struct GSTCacheGetHandle *) cgh; } @@ -422,7 +421,7 @@ call_cgh_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 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 @@ call_cgh_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 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 @@ call_cgh_cb (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @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 @@ peer_connect_notify_cb (void *cls, 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 @@ peer_connect_notify_cb (void *cls, 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 @@ peer_connect_notify_cb (void *cls, * @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 @@ opstart_get_handle_transport (void *cls) 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 @@ static void 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 @@ oprelease_get_handle_transport (void *cls) * @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 @@ core_startup_cb (void *cls, 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 @@ core_startup_cb (void *cls, * @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 @@ static void opstart_get_handle_core (void *cls) { struct CacheEntry *entry = cls; + const struct GNUNET_CORE_MessageHandler no_handlers[] = { {NULL, 0, 0} }; @@ -638,17 +633,15 @@ opstart_get_handle_core (void *cls) 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 @@ static void 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 @@ oprelease_get_handle_core (void *cls) * @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 @@ cache_get_handle (unsigned int peer_id, 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 @@ cache_get_handle (unsigned int peer_id, * 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 @@ GST_cache_get_handle_done (struct GSTCacheGetHandle *cgh) { 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 @@ GST_cache_get_handle_done (struct GSTCacheGetHandle *cgh) 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 @@ GST_cache_get_handle_transport (unsigned int peer_id, 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 @@ GST_cache_get_handle_transport (unsigned int peer_id, 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 @@ GST_cache_get_handle_core (unsigned int peer_id, 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 @@ GST_cache_lookup_hello (const unsigned int peer_id) { 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); diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c index 43841b461d..9b571e3ddc 100644 --- a/src/testbed/gnunet-service-testbed_oc.c +++ b/src/testbed/gnunet-service-testbed_oc.c @@ -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 TryConnectContext 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 @@ struct TryConnectContext /** - * 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 OverlayConnectContext struct GSTCacheGetHandle *cgh_p1th; /** - * Core handles of the first peer; used to notify when second peer connects to it - */ - //struct GNUNET_CORE_Handle *ch_; - - /** - * The GetCacheHandle for the p1th transport handle + * The GetCacheHandle for registering callback to notify CORE level peer + * connects and to get our identity. */ 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 @@ struct OverlayConnectContext 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 @@ struct OverlayConnectContext /** - * 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 @@ send_overlay_connect_success_msg (struct OverlayConnectContext *occ) * @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 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @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 @@ p2_transport_connect (struct OverlayConnectContext *occ) 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 @@ hello_update_cb (void *cls, const struct GNUNET_MessageHeader *hello) * @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 @@ p1_transport_connect_cache_callback (void *cls, struct GNUNET_CORE_Handle *ch, * @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 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, "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 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, 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 @@ occ_cache_get_handle_core_cb (void *cls, struct GNUNET_CORE_Handle *ch, "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 @@ overlay_connect_get_config (void *cls, const struct GNUNET_MessageHeader *msg) "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 @@ GST_handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client, "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 @@ timeout_rocc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @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 @@ attempt_connect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @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_cache_get_handle_transport_cb (void *cls, struct GNUNET_CORE_Handle *ch, } 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 @@ rocc_cache_get_handle_transport_cb (void *cls, struct GNUNET_CORE_Handle *ch, 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 @@ GST_handle_remote_overlay_connect (void *cls, 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); diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index dd6822a419..6581fffe64 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c @@ -973,10 +973,10 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, 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 |