aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2011-09-30 14:38:23 +0000
committerBart Polot <bart@net.in.tum.de>2011-09-30 14:38:23 +0000
commit1fab92101d43eb0b5abab878149e9bdc6dba5ae0 (patch)
tree3b17c85d4cadf53ecd5ee74742e029cb0de67995 /src/mesh
parent73841c2f316bc15237d0e22880fba01b8d09abde (diff)
downloadgnunet-1fab92101d43eb0b5abab878149e9bdc6dba5ae0.tar.gz
gnunet-1fab92101d43eb0b5abab878149e9bdc6dba5ae0.zip
Commented out DHT code, removed DHT-dependent test from run set.
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/Makefile.am2
-rw-r--r--src/mesh/gnunet-service-mesh.c209
2 files changed, 106 insertions, 105 deletions
diff --git a/src/mesh/Makefile.am b/src/mesh/Makefile.am
index 1f43b66d4..ad91ad16c 100644
--- a/src/mesh/Makefile.am
+++ b/src/mesh/Makefile.am
@@ -110,7 +110,7 @@ test_mesh_small_unicast_DEPENDENCIES = \
110 110
111if ENABLE_TEST_RUN 111if ENABLE_TEST_RUN
112if HAVE_EXPERIMENTAL 112if HAVE_EXPERIMENTAL
113TESTS = test_mesh_api test_mesh_path_api test_mesh_local_1 test_mesh_local_2 113TESTS = test_mesh_api test_mesh_path_api test_mesh_local_1
114endif 114endif
115endif 115endif
116 116
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c
index 19affd5a6..21ebfa634 100644
--- a/src/mesh/gnunet-service-mesh.c
+++ b/src/mesh/gnunet-service-mesh.c
@@ -361,7 +361,7 @@ struct MeshClient
361/************************ DEBUG FUNCTIONS ****************************/ 361/************************ DEBUG FUNCTIONS ****************************/
362/******************************************************************************/ 362/******************************************************************************/
363 363
364#if MESH_DEBUG 364#if LATER /* FIXME DHT */
365/** 365/**
366 * GNUNET_SCHEDULER_Task for printing a message after some operation is done 366 * GNUNET_SCHEDULER_Task for printing a message after some operation is done
367 * @param cls string to print 367 * @param cls string to print
@@ -409,7 +409,7 @@ static struct GNUNET_CORE_Handle *core_handle;
409/** 409/**
410 * Handle to use DHT 410 * Handle to use DHT
411 */ 411 */
412static struct GNUNET_DHT_Handle *dht_handle; 412//static struct GNUNET_DHT_Handle *dht_handle; FIXME DHT
413 413
414/** 414/**
415 * Handle to server 415 * Handle to server
@@ -496,7 +496,8 @@ static int
496announce_application (void *cls, const GNUNET_HashCode * key, void *value) 496announce_application (void *cls, const GNUNET_HashCode * key, void *value)
497{ 497{
498 /* FIXME are hashes in multihash map equal on all aquitectures? */ 498 /* FIXME are hashes in multihash map equal on all aquitectures? */
499 GNUNET_DHT_put (dht_handle, key, 10U, GNUNET_DHT_RO_RECORD_ROUTE, 499 /* FIXME DHT */
500/* GNUNET_DHT_put (dht_handle, key, 10U, GNUNET_DHT_RO_RECORD_ROUTE,
500 GNUNET_BLOCK_TYPE_TEST, sizeof (struct GNUNET_PeerIdentity), 501 GNUNET_BLOCK_TYPE_TEST, sizeof (struct GNUNET_PeerIdentity),
501 (const char *) &my_full_id, 502 (const char *) &my_full_id,
502#if MESH_DEBUG 503#if MESH_DEBUG
@@ -506,7 +507,7 @@ announce_application (void *cls, const GNUNET_HashCode * key, void *value)
506 GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), 507 GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
507 APP_ANNOUNCE_TIME), 508 APP_ANNOUNCE_TIME),
508 APP_ANNOUNCE_TIME, NULL, NULL); 509 APP_ANNOUNCE_TIME, NULL, NULL);
509#endif 510#endif*/
510 return GNUNET_OK; 511 return GNUNET_OK;
511} 512}
512 513
@@ -556,26 +557,26 @@ announce_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
556 */ 557 */
557 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: DHT_put for ID %s started.\n", 558 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: DHT_put for ID %s started.\n",
558 GNUNET_h2s_full (&my_full_id.hashPubKey)); 559 GNUNET_h2s_full (&my_full_id.hashPubKey));
559 GNUNET_DHT_put (dht_handle, /* DHT handle */ 560// GNUNET_DHT_put (dht_handle, /* DHT handle */ FIXME DHT
560 &my_full_id.hashPubKey, /* Key to use */ 561// &my_full_id.hashPubKey, /* Key to use */
561 10U, /* Replication level */ 562// 10U, /* Replication level */
562 GNUNET_DHT_RO_RECORD_ROUTE, /* DHT options */ 563// GNUNET_DHT_RO_RECORD_ROUTE, /* DHT options */
563 GNUNET_BLOCK_TYPE_TEST, /* Block type */ 564// GNUNET_BLOCK_TYPE_TEST, /* Block type */
564 sizeof(my_full_id), /* Size of the data */ 565// sizeof(my_full_id), /* Size of the data */
565 (char *)&my_full_id, /* Data itself */ 566// (char *)&my_full_id, /* Data itself */
566 GNUNET_TIME_absolute_get_forever (), /* Data expiration */ 567// GNUNET_TIME_absolute_get_forever (), /* Data expiration */
567 GNUNET_TIME_UNIT_FOREVER_REL, /* Retry time */ 568// GNUNET_TIME_UNIT_FOREVER_REL, /* Retry time */
568#if MESH_DEBUG 569// #if MESH_DEBUG
569 &mesh_debug, "DHT_put for id completed"); 570// &mesh_debug, "DHT_put for id completed");
570#else 571// #else
571 NULL, /* Continuation */ 572// NULL, /* Continuation */
572 NULL); /* Continuation closure */ 573// NULL); /* Continuation closure */
573#endif 574// #endif
574 announce_id_task = 575 announce_id_task =
575 GNUNET_SCHEDULER_add_delayed (ID_ANNOUNCE_TIME, &announce_id, cls); 576 GNUNET_SCHEDULER_add_delayed (ID_ANNOUNCE_TIME, &announce_id, cls);
576} 577}
577 578
578 579#if LATER /* FIXME DHT */
579/** 580/**
580 * Function to process paths received for a new peer addition. The recorded 581 * Function to process paths received for a new peer addition. The recorded
581 * paths form the initial tunnel, which can be optimized later. 582 * paths form the initial tunnel, which can be optimized later.
@@ -596,7 +597,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
596 const struct GNUNET_PeerIdentity *put_path, 597 const struct GNUNET_PeerIdentity *put_path,
597 unsigned int put_path_length, 598 unsigned int put_path_length,
598 enum GNUNET_BLOCK_Type type, size_t size, const void *data); 599 enum GNUNET_BLOCK_Type type, size_t size, const void *data);
599 600#endif
600 601
601/******************************************************************************/ 602/******************************************************************************/
602/****************** GENERAL HELPER FUNCTIONS ************************/ 603/****************** GENERAL HELPER FUNCTIONS ************************/
@@ -750,24 +751,24 @@ path_remove_from_peer (struct MeshPeerInfo *peer,
750 } 751 }
751 else 752 else
752 { 753 {
753 struct MeshPathInfo *path_info; 754// struct MeshPathInfo *path_info;
754 755
755 if (NULL != peer_d->dhtget) 756 if (NULL != peer_d->dhtget)
756 return; 757 return;
757 path_info = GNUNET_malloc(sizeof(struct MeshPathInfo)); 758// path_info = GNUNET_malloc(sizeof(struct MeshPathInfo)); FIXME DHT
758 path_info->path = p; 759// path_info->path = p;
759 path_info->peer = peer_d; 760// path_info->peer = peer_d;
760 path_info->t = peer->tunnels[i]; 761// path_info->t = peer->tunnels[i];
761 peer_d->dhtget = GNUNET_DHT_get_start(dht_handle, /* handle */ 762// peer_d->dhtget = GNUNET_DHT_get_start(dht_handle, /* handle */
762 GNUNET_TIME_UNIT_FOREVER_REL, /* timeout */ 763// GNUNET_TIME_UNIT_FOREVER_REL, /* timeout */
763 GNUNET_BLOCK_TYPE_TEST, /* type */ 764// GNUNET_BLOCK_TYPE_TEST, /* type */
764 &id.hashPubKey, /*key to search */ 765// &id.hashPubKey, /*key to search */
765 4, /* replication level */ 766// 4, /* replication level */
766 GNUNET_DHT_RO_RECORD_ROUTE, 767// GNUNET_DHT_RO_RECORD_ROUTE,
767 NULL, /* xquery */ 768// NULL, /* xquery */
768 0, /* xquery bits */ 769// 0, /* xquery bits */
769 &dht_get_id_handler, 770// &dht_get_id_handler,
770 (void *) path_info); 771// (void *) path_info);
771 } 772 }
772 } 773 }
773} 774}
@@ -838,6 +839,7 @@ path_add_to_origin (struct MeshPeerInfo *peer_info, struct MeshPeerPath *path)
838} 839}
839 840
840 841
842#if LATER /* FIXME DHT */
841/** 843/**
842 * Build a PeerPath from the paths returned from the DHT, reversing the paths 844 * Build a PeerPath from the paths returned from the DHT, reversing the paths
843 * to obtain a local peer -> destination path and interning the peer ids. 845 * to obtain a local peer -> destination path and interning the peer ids.
@@ -904,6 +906,7 @@ path_build_from_dht (const struct GNUNET_PeerIdentity *get_path,
904#endif 906#endif
905 return p; 907 return p;
906} 908}
909#endif
907 910
908 911
909/** 912/**
@@ -2081,7 +2084,7 @@ path_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2081 return; 2084 return;
2082} 2085}
2083 2086
2084 2087#if LATER /* FIXME DHT */
2085/** 2088/**
2086 * Function to process paths received for a new peer addition. The recorded 2089 * Function to process paths received for a new peer addition. The recorded
2087 * paths form the initial tunnel, which can be optimized later. 2090 * paths form the initial tunnel, which can be optimized later.
@@ -2122,16 +2125,16 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
2122 { 2125 {
2123 // Find ourselves some alternate initial path to the destination: retry 2126 // Find ourselves some alternate initial path to the destination: retry
2124 GNUNET_DHT_get_stop (path_info->peer->dhtget); 2127 GNUNET_DHT_get_stop (path_info->peer->dhtget);
2125 path_info->peer->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */ 2128// path_info->peer->dhtget = GNUNET_DHT_get_start (dht_handle, /* handle */ FIXME DHT
2126 GNUNET_TIME_UNIT_FOREVER_REL, /* timeout */ 2129// GNUNET_TIME_UNIT_FOREVER_REL, /* timeout */
2127 GNUNET_BLOCK_TYPE_TEST, /* type */ 2130// GNUNET_BLOCK_TYPE_TEST, /* type */
2128 &pi.hashPubKey, /*key to search */ 2131// &pi.hashPubKey, /*key to search */
2129 4, /* replication level */ 2132// 4, /* replication level */
2130 GNUNET_DHT_RO_RECORD_ROUTE, 2133// GNUNET_DHT_RO_RECORD_ROUTE,
2131 NULL, /* xquery */ 2134// NULL, /* xquery */
2132 0, /* xquery bits */ 2135// 0, /* xquery bits */
2133 &dht_get_id_handler, 2136// &dht_get_id_handler,
2134 (void *) path_info); 2137// (void *) path_info);
2135 return; 2138 return;
2136 } 2139 }
2137 } 2140 }
@@ -2223,27 +2226,27 @@ dht_get_type_handler (void *cls, struct GNUNET_TIME_Absolute exp,
2223 if ((NULL == get_path || NULL == put_path) && NULL == peer_info->path_head && 2226 if ((NULL == get_path || NULL == put_path) && NULL == peer_info->path_head &&
2224 NULL == peer_info->dhtget) 2227 NULL == peer_info->dhtget)
2225 { 2228 {
2226 path_info = GNUNET_malloc (sizeof (struct MeshPathInfo)); 2229// path_info = GNUNET_malloc (sizeof (struct MeshPathInfo)); FIXME DHT
2227 path_info->peer = peer_info; 2230// path_info->peer = peer_info;
2228 path_info->t = t; 2231// path_info->t = t;
2229 /* we don't have a route to the peer, let's try a direct lookup */ 2232// /* we don't have a route to the peer, let's try a direct lookup */
2230 peer_info->dhtget = GNUNET_DHT_get_start (dht_handle, 2233// peer_info->dhtget = GNUNET_DHT_get_start (dht_handle,
2231 /* handle */ 2234// /* handle */
2232 GNUNET_TIME_UNIT_FOREVER_REL, 2235// GNUNET_TIME_UNIT_FOREVER_REL,
2233 /* timeout */ 2236// /* timeout */
2234 GNUNET_BLOCK_TYPE_TEST, 2237// GNUNET_BLOCK_TYPE_TEST,
2235 /* block type */ 2238// /* block type */
2236 &pi->hashPubKey, 2239// &pi->hashPubKey,
2237 /* key to look up */ 2240// /* key to look up */
2238 10U, 2241// 10U,
2239 /* replication level */ 2242// /* replication level */
2240 GNUNET_DHT_RO_RECORD_ROUTE, 2243// GNUNET_DHT_RO_RECORD_ROUTE,
2241 /* option to dht: record route */ 2244// /* option to dht: record route */
2242 NULL, /* xquery */ 2245// NULL, /* xquery */
2243 0, /* xquery bits */ 2246// 0, /* xquery bits */
2244 dht_get_id_handler, 2247// dht_get_id_handler,
2245 /* callback */ 2248// /* callback */
2246 path_info); /* closure */ 2249// path_info); /* closure */
2247 return; 2250 return;
2248 } 2251 }
2249 2252
@@ -2294,6 +2297,8 @@ dht_get_type_handler (void *cls, struct GNUNET_TIME_Absolute exp,
2294 send_client_peer_connected(t, myid); 2297 send_client_peer_connected(t, myid);
2295} 2298}
2296 2299
2300#endif
2301
2297/******************************************************************************/ 2302/******************************************************************************/
2298/********************* MESH LOCAL HANDLES **************************/ 2303/********************* MESH LOCAL HANDLES **************************/
2299/******************************************************************************/ 2304/******************************************************************************/
@@ -2667,19 +2672,19 @@ handle_local_connect_add (void *cls, struct GNUNET_SERVER_Client *client,
2667 /* Start DHT search if needed, otherwise just add peer to tunnel. */ 2672 /* Start DHT search if needed, otherwise just add peer to tunnel. */
2668 if (NULL == peer_info->dhtget && NULL == peer_info->path_head) 2673 if (NULL == peer_info->dhtget && NULL == peer_info->path_head)
2669 { 2674 {
2670 path_info = GNUNET_malloc(sizeof(struct MeshPathInfo)); 2675// path_info = GNUNET_malloc(sizeof(struct MeshPathInfo));
2671 path_info->peer = peer_info; 2676// path_info->peer = peer_info;
2672 path_info->t = t; 2677// path_info->t = t;
2673 peer_info->dhtget = GNUNET_DHT_get_start(dht_handle, /* handle */ 2678// peer_info->dhtget = GNUNET_DHT_get_start(dht_handle, /* handle */ FIXME DHT
2674 GNUNET_TIME_UNIT_FOREVER_REL, /* timeout */ 2679// GNUNET_TIME_UNIT_FOREVER_REL, /* timeout */
2675 GNUNET_BLOCK_TYPE_TEST, /* type */ 2680// GNUNET_BLOCK_TYPE_TEST, /* type */
2676 &peer_msg->peer.hashPubKey, /*key to search */ 2681// &peer_msg->peer.hashPubKey, /*key to search */
2677 4, /* replication level */ 2682// 4, /* replication level */
2678 GNUNET_DHT_RO_RECORD_ROUTE, 2683// GNUNET_DHT_RO_RECORD_ROUTE,
2679 NULL, /* xquery */ 2684// NULL, /* xquery */
2680 0, /* xquery bits */ 2685// 0, /* xquery bits */
2681 &dht_get_id_handler, 2686// &dht_get_id_handler,
2682 (void *) path_info); 2687// (void *) path_info);
2683 } 2688 }
2684 else if (NULL != peer_info->path_head) 2689 else if (NULL != peer_info->path_head)
2685 { 2690 {
@@ -2859,11 +2864,11 @@ handle_local_connect_by_type (void *cls, struct GNUNET_SERVER_Client *client,
2859 } 2864 }
2860 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: looking in DHT for %s\n", 2865 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: looking in DHT for %s\n",
2861 GNUNET_h2s_full (&hash)); 2866 GNUNET_h2s_full (&hash));
2862 c->dht_get_type = 2867// c->dht_get_type = FIXME DHT
2863 GNUNET_DHT_get_start (dht_handle, GNUNET_TIME_UNIT_FOREVER_REL, 2868// GNUNET_DHT_get_start (dht_handle, GNUNET_TIME_UNIT_FOREVER_REL,
2864 GNUNET_BLOCK_TYPE_TEST, &hash, 10U, 2869// GNUNET_BLOCK_TYPE_TEST, &hash, 10U,
2865 GNUNET_DHT_RO_RECORD_ROUTE, NULL, 0, 2870// GNUNET_DHT_RO_RECORD_ROUTE, NULL, 0,
2866 &dht_get_type_handler, t); 2871// &dht_get_type_handler, t);
2867 2872
2868 GNUNET_SERVER_receive_done (client, GNUNET_OK); 2873 GNUNET_SERVER_receive_done (client, GNUNET_OK);
2869 return; 2874 return;
@@ -3174,7 +3179,7 @@ core_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer)
3174static void 3179static void
3175shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 3180shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3176{ 3181{
3177 struct MeshClient *c; 3182// struct MeshClient *c;
3178 3183
3179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: shutting down\n"); 3184 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: shutting down\n");
3180 if (core_handle != NULL) 3185 if (core_handle != NULL)
@@ -3182,14 +3187,14 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
3182 GNUNET_CORE_disconnect (core_handle); 3187 GNUNET_CORE_disconnect (core_handle);
3183 core_handle = NULL; 3188 core_handle = NULL;
3184 } 3189 }
3185 if (dht_handle != NULL) 3190// if (dht_handle != NULL) FIXME DHT
3186 { 3191// {
3187 for (c = clients; NULL != c; c = c->next) 3192// for (c = clients; NULL != c; c = c->next)
3188 if (NULL != c->dht_get_type) 3193// if (NULL != c->dht_get_type)
3189 GNUNET_DHT_get_stop (c->dht_get_type); 3194// GNUNET_DHT_get_stop (c->dht_get_type);
3190 GNUNET_DHT_disconnect (dht_handle); 3195// GNUNET_DHT_disconnect (dht_handle);
3191 dht_handle = NULL; 3196// dht_handle = NULL;
3192 } 3197// }
3193 if (nc != NULL) 3198 if (nc != NULL)
3194 { 3199 {
3195 GNUNET_SERVER_notification_context_destroy (nc); 3200 GNUNET_SERVER_notification_context_destroy (nc);
@@ -3263,15 +3268,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
3263 &my_full_id.hashPubKey); 3268 &my_full_id.hashPubKey);
3264 myid = GNUNET_PEER_intern (&my_full_id); 3269 myid = GNUNET_PEER_intern (&my_full_id);
3265 3270
3266 dht_handle = GNUNET_DHT_connect (c, 64); 3271// dht_handle = GNUNET_DHT_connect (c, 64); FIXME DHT
3267 if (dht_handle == NULL) 3272// if (dht_handle == NULL)
3268 { 3273// {
3269 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error connecting to DHT.\ 3274// GNUNET_break (0);
3270 Running without DHT has a severe\ 3275// }
3271 impact in MESH capabilities.\n\
3272 Plase check your configuretion and enable DHT.\n");
3273 GNUNET_break (0);
3274 }
3275 3276
3276 next_tid = 0; 3277 next_tid = 0;
3277 3278