diff options
author | Bart Polot <bart@net.in.tum.de> | 2011-08-06 20:21:44 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2011-08-06 20:21:44 +0000 |
commit | 79fdb70dea5c857406c26c77cce34f959a0adff7 (patch) | |
tree | 12aee3990dac64e890cd169d908683d7589396f0 /src | |
parent | 6b14c5b2afa1654e30c61bead981e343f544c23b (diff) | |
download | gnunet-79fdb70dea5c857406c26c77cce34f959a0adff7.tar.gz gnunet-79fdb70dea5c857406c26c77cce34f959a0adff7.zip |
Greetings from Philadelphia. Also, fixes.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 46 | ||||
-rw-r--r-- | src/mesh/test_mesh.conf | 6 |
2 files changed, 41 insertions, 11 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index 391045a10..61ff4d745 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -54,6 +54,15 @@ | |||
54 | #include "mesh_protocol.h" | 54 | #include "mesh_protocol.h" |
55 | #include "gnunet_dht_service.h" | 55 | #include "gnunet_dht_service.h" |
56 | 56 | ||
57 | #define MESH_DEBUG 0 | ||
58 | |||
59 | #if MESH_DEBUG | ||
60 | static void | ||
61 | mesh_debug (const char *s) | ||
62 | { | ||
63 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s", s); | ||
64 | } | ||
65 | #endif | ||
57 | 66 | ||
58 | #define CORE_QUEUE_SIZE 10 | 67 | #define CORE_QUEUE_SIZE 10 |
59 | #define LOCAL_QUEUE_SIZE 100 | 68 | #define LOCAL_QUEUE_SIZE 100 |
@@ -1098,7 +1107,7 @@ handle_mesh_path_create (void *cls, | |||
1098 | struct MeshPeerInfo *orig_peer_info; | 1107 | struct MeshPeerInfo *orig_peer_info; |
1099 | struct MeshTunnel *t; | 1108 | struct MeshTunnel *t; |
1100 | 1109 | ||
1101 | 1110 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received a MESH path create msg\n"); | |
1102 | size = ntohs(message->size); | 1111 | size = ntohs(message->size); |
1103 | if (size < sizeof(struct GNUNET_MESH_ManipulatePath)) { | 1112 | if (size < sizeof(struct GNUNET_MESH_ManipulatePath)) { |
1104 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, | 1113 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, |
@@ -1125,11 +1134,10 @@ handle_mesh_path_create (void *cls, | |||
1125 | t = retrieve_tunnel(pi, tid); | 1134 | t = retrieve_tunnel(pi, tid); |
1126 | 1135 | ||
1127 | if (NULL == t) { | 1136 | if (NULL == t) { |
1137 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Creating tunnel\n"); | ||
1128 | t = GNUNET_malloc(sizeof(struct MeshTunnel)); | 1138 | t = GNUNET_malloc(sizeof(struct MeshTunnel)); |
1129 | t->id.oid = GNUNET_PEER_intern(pi); | 1139 | t->id.oid = GNUNET_PEER_intern(pi); |
1130 | t->id.tid = tid; | 1140 | t->id.tid = tid; |
1131 | t->local_tid = 0; | ||
1132 | t->client = NULL; | ||
1133 | t->peers = GNUNET_CONTAINER_multihashmap_create(32); | 1141 | t->peers = GNUNET_CONTAINER_multihashmap_create(32); |
1134 | 1142 | ||
1135 | GNUNET_CRYPTO_hash(&t->id, sizeof(struct MESH_TunnelID), &hash); | 1143 | GNUNET_CRYPTO_hash(&t->id, sizeof(struct MESH_TunnelID), &hash); |
@@ -1139,8 +1147,7 @@ handle_mesh_path_create (void *cls, | |||
1139 | t, | 1147 | t, |
1140 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) | 1148 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) |
1141 | { | 1149 | { |
1142 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, | 1150 | GNUNET_break(0); |
1143 | "create path: could not store tunnel in hashmap\n"); | ||
1144 | return GNUNET_OK; | 1151 | return GNUNET_OK; |
1145 | } | 1152 | } |
1146 | 1153 | ||
@@ -2324,6 +2331,27 @@ core_init (void *cls, | |||
2324 | "Core init\n"); | 2331 | "Core init\n"); |
2325 | core_handle = server; | 2332 | core_handle = server; |
2326 | myid = GNUNET_PEER_intern(identity); | 2333 | myid = GNUNET_PEER_intern(identity); |
2334 | /* TODO | ||
2335 | * - Repeat every X seconds to avoid churn induced failures, | ||
2336 | * increase replication and diversify routes. | ||
2337 | * - Set data expiration in function of X | ||
2338 | * - Adapt X to churn | ||
2339 | */ | ||
2340 | GNUNET_DHT_put(dht_handle, /* DHT handle */ | ||
2341 | &identity->hashPubKey, /* Key to use */ | ||
2342 | 10U, /* Replication level */ | ||
2343 | GNUNET_DHT_RO_RECORD_ROUTE, /* DHT options */ | ||
2344 | GNUNET_BLOCK_TYPE_ANY, /* Block type */ | ||
2345 | 0, /* Size of the data */ | ||
2346 | NULL, /* Data itself */ | ||
2347 | GNUNET_TIME_absolute_get_forever(), /* Data expiration */ | ||
2348 | GNUNET_TIME_UNIT_FOREVER_REL, /* Retry time */ | ||
2349 | #if MESH_DEBUG | ||
2350 | |||
2351 | #else | ||
2352 | NULL, /* Continuation */ | ||
2353 | NULL); /* Continuation closure */ | ||
2354 | #endif | ||
2327 | return; | 2355 | return; |
2328 | } | 2356 | } |
2329 | 2357 | ||
@@ -2460,8 +2488,14 @@ run (void *cls, | |||
2460 | } | 2488 | } |
2461 | dht_handle = GNUNET_DHT_connect(c, 64); | 2489 | dht_handle = GNUNET_DHT_connect(c, 64); |
2462 | if (dht_handle == NULL) { | 2490 | if (dht_handle == NULL) { |
2491 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | ||
2492 | "Error connecting to DHT.\ | ||
2493 | Running without DHT has a severe\ | ||
2494 | impact in MESH capabilities.\n\ | ||
2495 | Plase check your configuretion and enable DHT.\n"); | ||
2463 | GNUNET_break(0); | 2496 | GNUNET_break(0); |
2464 | } | 2497 | } |
2498 | |||
2465 | next_tid = 0; | 2499 | next_tid = 0; |
2466 | 2500 | ||
2467 | tunnels = GNUNET_CONTAINER_multihashmap_create(32); | 2501 | tunnels = GNUNET_CONTAINER_multihashmap_create(32); |
@@ -2476,7 +2510,7 @@ run (void *cls, | |||
2476 | &shutdown_task, NULL); | 2510 | &shutdown_task, NULL); |
2477 | 2511 | ||
2478 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2512 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2479 | "end if run()\n"); | 2513 | "end of run()\n"); |
2480 | } | 2514 | } |
2481 | 2515 | ||
2482 | /** | 2516 | /** |
diff --git a/src/mesh/test_mesh.conf b/src/mesh/test_mesh.conf index 94d464d54..6563073bc 100644 --- a/src/mesh/test_mesh.conf +++ b/src/mesh/test_mesh.conf | |||
@@ -5,7 +5,7 @@ AUTOSTART = NO | |||
5 | AUTOSTART = NO | 5 | AUTOSTART = NO |
6 | 6 | ||
7 | [mesh] | 7 | [mesh] |
8 | DEBUG = NO | 8 | DEBUG = YES |
9 | AUTOSTART = YES | 9 | AUTOSTART = YES |
10 | ACCEPT_FROM = 127.0.0.1; | 10 | ACCEPT_FROM = 127.0.0.1; |
11 | HOSTNAME = localhost | 11 | HOSTNAME = localhost |
@@ -61,9 +61,5 @@ SERVICEHOME = /tmp/test-mesh/ | |||
61 | [dns] | 61 | [dns] |
62 | AUTOSTART = NO | 62 | AUTOSTART = NO |
63 | 63 | ||
64 | |||
65 | |||
66 | [nse] | 64 | [nse] |
67 | AUTOSTART = NO | 65 | AUTOSTART = NO |
68 | |||
69 | |||