diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-08-01 11:30:57 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-08-01 11:30:57 +0000 |
commit | 9d095c5d0f48bd691b2f9086956e454427802464 (patch) | |
tree | 722edffde70561323c07d6e4f6acb855bfb318b8 /src | |
parent | ebfff277d665c418845f138aaf2b597ef29624ae (diff) | |
download | gnunet-9d095c5d0f48bd691b2f9086956e454427802464.tar.gz gnunet-9d095c5d0f48bd691b2f9086956e454427802464.zip |
- channel management
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh-enc.c | 225 |
1 files changed, 111 insertions, 114 deletions
diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index f2eb0f98c..3e34b544f 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c | |||
@@ -421,21 +421,21 @@ struct MeshChannel | |||
421 | struct MeshTunnel2 *t; | 421 | struct MeshTunnel2 *t; |
422 | 422 | ||
423 | /** | 423 | /** |
424 | * Port of the channel. | 424 | * Destination port of the channel. |
425 | */ | 425 | */ |
426 | uint32_t port; | 426 | uint32_t port; |
427 | 427 | ||
428 | /** | 428 | /** |
429 | * Local tunnel number ( >= GNUNET_MESH_LOCAL_CHANNEL_ID_CLI or 0 ) | 429 | * Local tunnel number ( >= GNUNET_MESH_LOCAL_CHANNEL_ID_CLI or 0 ) |
430 | */ | 430 | */ |
431 | MESH_ChannelNumber local_tid; | 431 | MESH_ChannelNumber id; |
432 | 432 | ||
433 | /** | 433 | /** |
434 | * Local tunnel number for local destination clients (incoming number) | 434 | * Local tunnel number for local destination clients (incoming number) |
435 | * ( >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV or 0). All clients share the same | 435 | * ( >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV or 0). All clients share the same |
436 | * number. | 436 | * number. |
437 | */ | 437 | */ |
438 | MESH_ChannelNumber local_tid_dest; | 438 | MESH_ChannelNumber id_dest; |
439 | 439 | ||
440 | /** | 440 | /** |
441 | * Is the tunnel bufferless (minimum latency)? | 441 | * Is the tunnel bufferless (minimum latency)? |
@@ -448,11 +448,6 @@ struct MeshChannel | |||
448 | int reliable; | 448 | int reliable; |
449 | 449 | ||
450 | /** | 450 | /** |
451 | * Force sending ACK? Flag to allow duplicate ACK on POLL. | ||
452 | */ | ||
453 | int force_ack; | ||
454 | |||
455 | /** | ||
456 | * Last time the channel was used | 451 | * Last time the channel was used |
457 | */ | 452 | */ |
458 | struct GNUNET_TIME_Absolute timestamp; | 453 | struct GNUNET_TIME_Absolute timestamp; |
@@ -1244,14 +1239,14 @@ client_delete_channel (struct MeshClient *c, struct MeshChannel *ch) | |||
1244 | if (c == ch->owner) | 1239 | if (c == ch->owner) |
1245 | { | 1240 | { |
1246 | res = GNUNET_CONTAINER_multihashmap32_remove (c->own_channels, | 1241 | res = GNUNET_CONTAINER_multihashmap32_remove (c->own_channels, |
1247 | ch->local_tid, ch); | 1242 | ch->id, ch); |
1248 | if (GNUNET_YES != res) | 1243 | if (GNUNET_YES != res) |
1249 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client_delete_channel owner KO\n"); | 1244 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client_delete_channel owner KO\n"); |
1250 | } | 1245 | } |
1251 | if (c == ch->client) | 1246 | if (c == ch->client) |
1252 | { | 1247 | { |
1253 | res = GNUNET_CONTAINER_multihashmap32_remove (c->incoming_channels, | 1248 | res = GNUNET_CONTAINER_multihashmap32_remove (c->incoming_channels, |
1254 | ch->local_tid_dest, ch); | 1249 | ch->id_dest, ch); |
1255 | if (GNUNET_YES != res) | 1250 | if (GNUNET_YES != res) |
1256 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client_delete_tunnel client KO\n"); | 1251 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "client_delete_tunnel client KO\n"); |
1257 | } | 1252 | } |
@@ -1305,7 +1300,7 @@ send_local_channel_destroy (struct MeshChannel *ch, int fwd) | |||
1305 | } | 1300 | } |
1306 | msg.header.size = htons (sizeof (msg)); | 1301 | msg.header.size = htons (sizeof (msg)); |
1307 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY); | 1302 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY); |
1308 | msg.channel_id = htonl (fwd ? ch->local_tid_dest : ch->local_tid); | 1303 | msg.channel_id = htonl (fwd ? ch->id_dest : ch->id); |
1309 | msg.port = htonl (0); | 1304 | msg.port = htonl (0); |
1310 | memset (&msg.peer, 0, sizeof (msg.peer)); | 1305 | memset (&msg.peer, 0, sizeof (msg.peer)); |
1311 | msg.opt = htonl (0); | 1306 | msg.opt = htonl (0); |
@@ -1330,7 +1325,7 @@ send_local_ack (struct MeshChannel *ch, | |||
1330 | 1325 | ||
1331 | msg.header.size = htons (sizeof (msg)); | 1326 | msg.header.size = htons (sizeof (msg)); |
1332 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK); | 1327 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_ACK); |
1333 | msg.channel_id = htonl (is_fwd ? ch->local_tid : ch->local_tid_dest); | 1328 | msg.channel_id = htonl (is_fwd ? ch->id : ch->id_dest); |
1334 | GNUNET_SERVER_notification_context_unicast (nc, | 1329 | GNUNET_SERVER_notification_context_unicast (nc, |
1335 | c->handle, | 1330 | c->handle, |
1336 | &msg.header, | 1331 | &msg.header, |
@@ -2391,14 +2386,14 @@ path_add_to_peers (struct MeshPeerPath *p, int confirmed) | |||
2391 | 2386 | ||
2392 | 2387 | ||
2393 | /** | 2388 | /** |
2394 | * Search for a tunnel among the tunnels for a client | 2389 | * Search for a channel among the channels for a client |
2395 | * | 2390 | * |
2396 | * @param c the client whose tunnels to search in | 2391 | * @param c the client whose channels to search in |
2397 | * @param tid the local id of the tunnel | 2392 | * @param chid the local id of the channel |
2398 | * | 2393 | * |
2399 | * @return tunnel handler, NULL if doesn't exist | 2394 | * @return channel handler, NULL if doesn't exist |
2400 | */ | 2395 | */ |
2401 | static struct MeshTunnel * | 2396 | static struct MeshChannel * |
2402 | channel_get_by_local_id (struct MeshClient *c, MESH_ChannelNumber chid) | 2397 | channel_get_by_local_id (struct MeshClient *c, MESH_ChannelNumber chid) |
2403 | { | 2398 | { |
2404 | if (0 == (chid & GNUNET_MESH_LOCAL_CHANNEL_ID_CLI)) | 2399 | if (0 == (chid & GNUNET_MESH_LOCAL_CHANNEL_ID_CLI)) |
@@ -2408,9 +2403,7 @@ channel_get_by_local_id (struct MeshClient *c, MESH_ChannelNumber chid) | |||
2408 | return NULL; | 2403 | return NULL; |
2409 | } | 2404 | } |
2410 | if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV) | 2405 | if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV) |
2411 | { | 2406 | return GNUNET_CONTAINER_multihashmap32_get (c->incoming_channels, chid); |
2412 | return channel_get_incoming (chid); | ||
2413 | } | ||
2414 | return GNUNET_CONTAINER_multihashmap32_get (c->own_channels, chid); | 2407 | return GNUNET_CONTAINER_multihashmap32_get (c->own_channels, chid); |
2415 | } | 2408 | } |
2416 | 2409 | ||
@@ -2458,12 +2451,12 @@ static void | |||
2458 | tunnel_change_state (struct MeshTunnel2* t, enum MeshTunnelState state) | 2451 | tunnel_change_state (struct MeshTunnel2* t, enum MeshTunnelState state) |
2459 | { | 2452 | { |
2460 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2453 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2461 | "Tunnel %s[%X] state was %s\n", | 2454 | "Tunnel %s state was %s\n", |
2462 | GNUNET_i2s (GNUNET_PEER_resolve2 (t->id.oid)), t->id.tid, | 2455 | GNUNET_i2s (GNUNET_PEER_resolve2 (t->peer->id)), |
2463 | GNUNET_MESH_DEBUG_TS2S (t->state)); | 2456 | GNUNET_MESH_DEBUG_TS2S (t->state)); |
2464 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2457 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2465 | "Tunnel %s[%X] state is now %s\n", | 2458 | "Tunnel %s state is now %s\n", |
2466 | GNUNET_i2s (GNUNET_PEER_resolve2 (t->id.oid)), t->id.tid, | 2459 | GNUNET_i2s (GNUNET_PEER_resolve2 (t->peer->id)), |
2467 | GNUNET_MESH_DEBUG_TS2S (state)); | 2460 | GNUNET_MESH_DEBUG_TS2S (state)); |
2468 | t->state = state; | 2461 | t->state = state; |
2469 | } | 2462 | } |
@@ -2930,14 +2923,14 @@ tunnel_free_reliable_message (struct MeshReliableMessage *copy) | |||
2930 | 2923 | ||
2931 | 2924 | ||
2932 | /** | 2925 | /** |
2933 | * Destroy all reliable messages queued for a tunnel, | 2926 | * Destroy all reliable messages queued for a channel, |
2934 | * during a tunnel destruction. | 2927 | * during a channel destruction. |
2935 | * Frees the reliability structure itself. | 2928 | * Frees the reliability structure itself. |
2936 | * | 2929 | * |
2937 | * @param rel Reliability data for a tunnel. | 2930 | * @param rel Reliability data for a channel. |
2938 | */ | 2931 | */ |
2939 | static void | 2932 | static void |
2940 | tunnel_free_reliable_all (struct MeshChannelReliability *rel) | 2933 | channel_free_reliable_all (struct MeshChannelReliability *rel) |
2941 | { | 2934 | { |
2942 | struct MeshReliableMessage *copy; | 2935 | struct MeshReliableMessage *copy; |
2943 | struct MeshReliableMessage *next; | 2936 | struct MeshReliableMessage *next; |
@@ -3293,40 +3286,6 @@ tunnel_destroy (struct MeshTunnel *t) | |||
3293 | r = GNUNET_SYSERR; | 3286 | r = GNUNET_SYSERR; |
3294 | } | 3287 | } |
3295 | 3288 | ||
3296 | if (NULL != c) | ||
3297 | { | ||
3298 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap32_remove (c->own_tunnels, | ||
3299 | t->local_tid, t)) | ||
3300 | { | ||
3301 | GNUNET_break (0); | ||
3302 | r = GNUNET_SYSERR; | ||
3303 | } | ||
3304 | } | ||
3305 | |||
3306 | c = t->client; | ||
3307 | if (NULL != c) | ||
3308 | { | ||
3309 | if (GNUNET_YES != | ||
3310 | GNUNET_CONTAINER_multihashmap32_remove (c->incoming_tunnels, | ||
3311 | t->local_tid_dest, t)) | ||
3312 | { | ||
3313 | GNUNET_break (0); | ||
3314 | r = GNUNET_SYSERR; | ||
3315 | } | ||
3316 | if (GNUNET_YES != | ||
3317 | GNUNET_CONTAINER_multihashmap32_remove (incoming_tunnels, | ||
3318 | t->local_tid_dest, t)) | ||
3319 | { | ||
3320 | GNUNET_break (0); | ||
3321 | r = GNUNET_SYSERR; | ||
3322 | } | ||
3323 | } | ||
3324 | |||
3325 | if(GNUNET_YES == t->reliable) | ||
3326 | { | ||
3327 | tunnel_free_reliable_all (t->fwd_rel); | ||
3328 | tunnel_free_reliable_all (t->bck_rel); | ||
3329 | } | ||
3330 | if (0 != t->prev_hop) | 3289 | if (0 != t->prev_hop) |
3331 | { | 3290 | { |
3332 | peer_cancel_queues (t->prev_hop, t); | 3291 | peer_cancel_queues (t->prev_hop, t); |
@@ -3409,48 +3368,79 @@ fc_init (struct MeshFlowControl *fc) | |||
3409 | fc->queue_n = 0; | 3368 | fc->queue_n = 0; |
3410 | } | 3369 | } |
3411 | 3370 | ||
3371 | |||
3412 | /** | 3372 | /** |
3413 | * Create a new tunnel | 3373 | * Destroy a channel and free all resources. |
3414 | * | 3374 | * |
3415 | * @param owner Who is the owner of the tunnel (short ID). | 3375 | * @param ch Channel to destroy. |
3416 | * @param tid Tunnel Number of the tunnel. | 3376 | */ |
3417 | * @param client Clients that owns the tunnel, NULL for foreign tunnels. | 3377 | static void |
3418 | * @param local Tunnel Number for the tunnel, for the client point of view. | 3378 | channel_destroy (struct MeshChannel *ch) |
3379 | { | ||
3380 | struct MeshClient *c; | ||
3381 | |||
3382 | if (NULL == ch) | ||
3383 | return; | ||
3384 | |||
3385 | c = ch->owner; | ||
3386 | if (NULL != c) | ||
3387 | { | ||
3388 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap32_remove (c->own_channels, | ||
3389 | c->id, ch)) | ||
3390 | { | ||
3391 | GNUNET_break (0); | ||
3392 | } | ||
3393 | } | ||
3394 | |||
3395 | c = ch->client; | ||
3396 | if (NULL != c) | ||
3397 | { | ||
3398 | if (GNUNET_YES != | ||
3399 | GNUNET_CONTAINER_multihashmap32_remove (c->incoming_channels, | ||
3400 | ch->id_dest, ch)) | ||
3401 | { | ||
3402 | GNUNET_break (0); | ||
3403 | } | ||
3404 | } | ||
3405 | |||
3406 | if (GNUNET_YES == ch->reliable) | ||
3407 | { | ||
3408 | channel_free_reliable_all (ch->fwd_rel); | ||
3409 | channel_free_reliable_all (ch->bck_rel); | ||
3410 | } | ||
3411 | |||
3412 | GNUNET_free (ch); | ||
3413 | } | ||
3414 | |||
3415 | /** | ||
3416 | * Create a new channel. | ||
3417 | * | ||
3418 | * @param owner Clients that owns the channel, NULL for foreign channels. | ||
3419 | * @param id Channel Number for the channel, for the owner point of view. | ||
3419 | * | 3420 | * |
3420 | * @return A new initialized tunnel. NULL on error. | 3421 | * @return A new initialized channel. NULL on error. |
3421 | */ | 3422 | */ |
3422 | static struct MeshTunnel * | 3423 | static struct MeshChannel * |
3423 | tunnel_new (GNUNET_PEER_Id owner, | 3424 | channel_new (struct MeshClient *owner, |
3424 | MESH_ChannelNumber tid, | 3425 | MESH_ChannelNumber id) |
3425 | struct MeshClient *client, | ||
3426 | MESH_ChannelNumber local) | ||
3427 | { | 3426 | { |
3428 | struct MeshTunnel *t; | 3427 | struct MeshChannel *ch; |
3429 | struct GNUNET_HashCode hash; | ||
3430 | 3428 | ||
3431 | if (n_tunnels >= max_tunnels && NULL == client) | 3429 | if (NULL == owner) |
3432 | return NULL; | 3430 | return NULL; |
3433 | 3431 | ||
3434 | t = GNUNET_malloc (sizeof (struct MeshTunnel)); | 3432 | ch = GNUNET_new (struct MeshChannel); |
3435 | t->id.oid = owner; | 3433 | ch->owner = owner; |
3436 | t->id.tid = tid; | 3434 | ch->id = id; |
3437 | t->queue_max = (max_msgs_queue / max_tunnels) + 1; | 3435 | |
3438 | t->owner = client; | 3436 | GNUNET_STATISTICS_update (stats, "# channel", 1, GNUNET_NO); |
3439 | fc_init (&t->next_fc); | ||
3440 | fc_init (&t->prev_fc); | ||
3441 | t->next_fc.t = t; | ||
3442 | t->prev_fc.t = t; | ||
3443 | t->local_tid = local; | ||
3444 | n_tunnels++; | ||
3445 | GNUNET_STATISTICS_update (stats, "# tunnels", 1, GNUNET_NO); | ||
3446 | 3437 | ||
3447 | GNUNET_CRYPTO_hash (&t->id, sizeof (struct MESH_TunnelID), &hash); | ||
3448 | if (GNUNET_OK != | 3438 | if (GNUNET_OK != |
3449 | GNUNET_CONTAINER_multihashmap_put (tunnels, &hash, t, | 3439 | GNUNET_CONTAINER_multihashmap32_put (owner->own_channels, id, ch, |
3450 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) | 3440 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) |
3451 | { | 3441 | { |
3452 | GNUNET_break (0); | 3442 | GNUNET_break (0); |
3453 | tunnel_destroy (t); | 3443 | channel_destroy (t); |
3454 | if (NULL != client) | 3444 | if (NULL != client) |
3455 | { | 3445 | { |
3456 | GNUNET_break (0); | 3446 | GNUNET_break (0); |
@@ -5200,8 +5190,8 @@ handle_local_new_client (void *cls, struct GNUNET_SERVER_Client *client, | |||
5200 | } | 5190 | } |
5201 | } | 5191 | } |
5202 | 5192 | ||
5203 | c->own_tunnels = GNUNET_CONTAINER_multihashmap32_create (32); | 5193 | c->own_channels = GNUNET_CONTAINER_multihashmap32_create (32); |
5204 | c->incoming_tunnels = GNUNET_CONTAINER_multihashmap32_create (32); | 5194 | c->incoming_channels = GNUNET_CONTAINER_multihashmap32_create (32); |
5205 | GNUNET_SERVER_notification_context_add (nc, client); | 5195 | GNUNET_SERVER_notification_context_add (nc, client); |
5206 | GNUNET_STATISTICS_update (stats, "# clients", 1, GNUNET_NO); | 5196 | GNUNET_STATISTICS_update (stats, "# clients", 1, GNUNET_NO); |
5207 | 5197 | ||
@@ -5218,16 +5208,17 @@ handle_local_new_client (void *cls, struct GNUNET_SERVER_Client *client, | |||
5218 | * @param message The actual message. | 5208 | * @param message The actual message. |
5219 | */ | 5209 | */ |
5220 | static void | 5210 | static void |
5221 | handle_local_tunnel_create (void *cls, struct GNUNET_SERVER_Client *client, | 5211 | handle_local_channel_create (void *cls, struct GNUNET_SERVER_Client *client, |
5222 | const struct GNUNET_MessageHeader *message) | 5212 | const struct GNUNET_MessageHeader *message) |
5223 | { | 5213 | { |
5224 | struct GNUNET_MESH_ChannelMessage *t_msg; | 5214 | struct GNUNET_MESH_ChannelMessage *msg; |
5225 | struct MeshPeer *peer_info; | 5215 | struct MeshPeer *peer; |
5226 | struct MeshTunnel *t; | 5216 | struct MeshTunnel2 *t; |
5217 | struct MeshChannel *ch; | ||
5227 | struct MeshClient *c; | 5218 | struct MeshClient *c; |
5228 | MESH_ChannelNumber tid; | 5219 | MESH_ChannelNumber chid; |
5229 | 5220 | ||
5230 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new tunnel requested\n"); | 5221 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new channel requested\n"); |
5231 | 5222 | ||
5232 | /* Sanity check for client registration */ | 5223 | /* Sanity check for client registration */ |
5233 | if (NULL == (c = client_get (client))) | 5224 | if (NULL == (c = client_get (client))) |
@@ -5246,22 +5237,28 @@ handle_local_tunnel_create (void *cls, struct GNUNET_SERVER_Client *client, | |||
5246 | return; | 5237 | return; |
5247 | } | 5238 | } |
5248 | 5239 | ||
5249 | t_msg = (struct GNUNET_MESH_ChannelMessage *) message; | 5240 | msg = (struct GNUNET_MESH_ChannelMessage *) message; |
5250 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n", | 5241 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " towards %s:%u\n", |
5251 | GNUNET_i2s (&t_msg->peer), ntohl (t_msg->port)); | 5242 | GNUNET_i2s (&msg->peer), ntohl (msg->port)); |
5252 | tid = ntohl (t_msg->channel_id); | 5243 | chid = ntohl (msg->channel_id); |
5244 | |||
5253 | /* Sanity check for duplicate tunnel IDs */ | 5245 | /* Sanity check for duplicate tunnel IDs */ |
5254 | if (NULL != channel_get_by_local_id (c, tid)) | 5246 | if (NULL != channel_get_by_local_id (c, chid)) |
5255 | { | 5247 | { |
5256 | GNUNET_break (0); | 5248 | GNUNET_break (0); |
5257 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 5249 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
5258 | return; | 5250 | return; |
5259 | } | 5251 | } |
5260 | 5252 | ||
5261 | /* Create tunnel */ | 5253 | peer = peer_get (&msg->peer); |
5254 | if (NULL == peer->tunnel) | ||
5255 | peer->tunnel = tunnel_new (); | ||
5256 | t = peer->tunnel; | ||
5257 | |||
5258 | /* Create channel */ | ||
5262 | while (NULL != channel_get_by_pi (myid, next_tid)) | 5259 | while (NULL != channel_get_by_pi (myid, next_tid)) |
5263 | next_tid = (next_tid + 1) & ~GNUNET_MESH_LOCAL_CHANNEL_ID_CLI; | 5260 | next_tid = (next_tid + 1) & ~GNUNET_MESH_LOCAL_CHANNEL_ID_CLI; |
5264 | t = tunnel_new (myid, next_tid, c, tid); | 5261 | t = tunnel_new (myid, next_tid, c, chid); |
5265 | next_tid = (next_tid + 1) & ~GNUNET_MESH_LOCAL_CHANNEL_ID_CLI; | 5262 | next_tid = (next_tid + 1) & ~GNUNET_MESH_LOCAL_CHANNEL_ID_CLI; |
5266 | if (NULL == t) | 5263 | if (NULL == t) |
5267 | { | 5264 | { |
@@ -5269,8 +5266,8 @@ handle_local_tunnel_create (void *cls, struct GNUNET_SERVER_Client *client, | |||
5269 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 5266 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
5270 | return; | 5267 | return; |
5271 | } | 5268 | } |
5272 | t->port = ntohl (t_msg->port); | 5269 | t->port = ntohl (msg->port); |
5273 | tunnel_set_options (t, ntohl (t_msg->opt)); | 5270 | tunnel_set_options (t, ntohl (msg->opt)); |
5274 | if (GNUNET_YES == t->reliable) | 5271 | if (GNUNET_YES == t->reliable) |
5275 | { | 5272 | { |
5276 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n"); | 5273 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "!!! Reliable\n"); |
@@ -5282,7 +5279,7 @@ handle_local_tunnel_create (void *cls, struct GNUNET_SERVER_Client *client, | |||
5282 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CREATED TUNNEL %s[%x]:%u (%x)\n", | 5279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CREATED TUNNEL %s[%x]:%u (%x)\n", |
5283 | GNUNET_i2s (&my_full_id), t->id.tid, t->port, t->local_tid); | 5280 | GNUNET_i2s (&my_full_id), t->id.tid, t->port, t->local_tid); |
5284 | 5281 | ||
5285 | peer_info = peer_get (&t_msg->peer); | 5282 | peer_info = peer_get (&msg->peer); |
5286 | peer_add_tunnel (peer_info, t); | 5283 | peer_add_tunnel (peer_info, t); |
5287 | peer_connect (peer_info, t); | 5284 | peer_connect (peer_info, t); |
5288 | tunnel_reset_timeout (t, GNUNET_YES); | 5285 | tunnel_reset_timeout (t, GNUNET_YES); |
@@ -5299,7 +5296,7 @@ handle_local_tunnel_create (void *cls, struct GNUNET_SERVER_Client *client, | |||
5299 | * @param message the actual message | 5296 | * @param message the actual message |
5300 | */ | 5297 | */ |
5301 | static void | 5298 | static void |
5302 | handle_local_tunnel_destroy (void *cls, struct GNUNET_SERVER_Client *client, | 5299 | handle_local_channel_destroy (void *cls, struct GNUNET_SERVER_Client *client, |
5303 | const struct GNUNET_MessageHeader *message) | 5300 | const struct GNUNET_MessageHeader *message) |
5304 | { | 5301 | { |
5305 | struct GNUNET_MESH_ChannelMessage *tunnel_msg; | 5302 | struct GNUNET_MESH_ChannelMessage *tunnel_msg; |
@@ -5694,11 +5691,11 @@ handle_local_show_tunnel (void *cls, struct GNUNET_SERVER_Client *client, | |||
5694 | static struct GNUNET_SERVER_MessageHandler client_handlers[] = { | 5691 | static struct GNUNET_SERVER_MessageHandler client_handlers[] = { |
5695 | {&handle_local_new_client, NULL, | 5692 | {&handle_local_new_client, NULL, |
5696 | GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT, 0}, | 5693 | GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT, 0}, |
5697 | {&handle_local_tunnel_create, NULL, | 5694 | {&handle_local_channel_create, NULL, |
5698 | GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE, | 5695 | GNUNET_MESSAGE_TYPE_MESH_LOCAL_CHANNEL_CREATE, |
5699 | sizeof (struct GNUNET_MESH_ChannelMessage)}, | 5696 | sizeof (struct GNUNET_MESH_ChannelMessage)}, |
5700 | {&handle_local_tunnel_destroy, NULL, | 5697 | {&handle_local_channel_destroy, NULL, |
5701 | GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_DESTROY, | 5698 | GNUNET_MESSAGE_TYPE_MESH_LOCAL_CHANNEL_DESTROY, |
5702 | sizeof (struct GNUNET_MESH_ChannelMessage)}, | 5699 | sizeof (struct GNUNET_MESH_ChannelMessage)}, |
5703 | {&handle_local_data, NULL, | 5700 | {&handle_local_data, NULL, |
5704 | GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA, 0}, | 5701 | GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA, 0}, |