diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-08-01 14:11:28 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-08-01 14:11:28 +0000 |
commit | b9625263b024a2838fa6e2bcf8b43a6c78a07d0e (patch) | |
tree | cc82041b620bfba5931399b14263da2838d23ba8 /src | |
parent | 4424bf81b5a7b4b6500a132e174794d1e5a3f6dd (diff) | |
download | gnunet-b9625263b024a2838fa6e2bcf8b43a6c78a07d0e.tar.gz gnunet-b9625263b024a2838fa6e2bcf8b43a6c78a07d0e.zip |
- channel messages do not include tunnel info
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh-enc.c | 56 | ||||
-rw-r--r-- | src/mesh/mesh_protocol_enc.h | 9 |
2 files changed, 34 insertions, 31 deletions
diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index 3e34b544f..e0df91498 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c | |||
@@ -1268,7 +1268,7 @@ send_local_channel_create (struct MeshChannel *ch) | |||
1268 | return; | 1268 | return; |
1269 | msg.header.size = htons (sizeof (msg)); | 1269 | msg.header.size = htons (sizeof (msg)); |
1270 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE); | 1270 | msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE); |
1271 | msg.channel_id = htonl (ch->local_tid_dest); | 1271 | msg.channel_id = htonl (ch->id_dest); |
1272 | msg.port = htonl (ch->port); | 1272 | msg.port = htonl (ch->port); |
1273 | msg.opt = 0; | 1273 | msg.opt = 0; |
1274 | msg.opt |= GNUNET_YES == ch->reliable ? GNUNET_MESH_OPTION_RELIABLE : 0; | 1274 | msg.opt |= GNUNET_YES == ch->reliable ? GNUNET_MESH_OPTION_RELIABLE : 0; |
@@ -1456,6 +1456,23 @@ send_prebuilt_message_tunnel (const struct GNUNET_MessageHeader *message, | |||
1456 | 1456 | ||
1457 | 1457 | ||
1458 | /** | 1458 | /** |
1459 | * Sends an already built message on a channel, properly registering | ||
1460 | * all used resources. | ||
1461 | * | ||
1462 | * @param message Message to send. Function makes a copy of it. | ||
1463 | * @param ch Channel on which this message is transmitted. | ||
1464 | * @param fwd Is this a fwd message? | ||
1465 | */ | ||
1466 | static void | ||
1467 | send_prebuilt_message_channel (const struct GNUNET_MessageHeader *message, | ||
1468 | struct MeshChannel *ch, | ||
1469 | int fwd) | ||
1470 | { | ||
1471 | send_prebuilt_message_tunnel (message, ch->t, ch, fwd); | ||
1472 | } | ||
1473 | |||
1474 | |||
1475 | /** | ||
1459 | * Sends an already built message directly to a peer. | 1476 | * Sends an already built message directly to a peer. |
1460 | * | 1477 | * |
1461 | * @param message Message to send. Function makes a copy of it. | 1478 | * @param message Message to send. Function makes a copy of it. |
@@ -2479,7 +2496,7 @@ connection_change_state (struct MeshConnection* c, | |||
2479 | 2496 | ||
2480 | 2497 | ||
2481 | /** | 2498 | /** |
2482 | * Add a client to a tunnel, initializing all needed data structures. | 2499 | * Add a client to a channel, initializing all needed data structures. |
2483 | * | 2500 | * |
2484 | * @param ch Channel to which add the client. | 2501 | * @param ch Channel to which add the client. |
2485 | * @param c Client which to add to the channel. | 2502 | * @param c Client which to add to the channel. |
@@ -2487,28 +2504,20 @@ connection_change_state (struct MeshConnection* c, | |||
2487 | static void | 2504 | static void |
2488 | channel_add_client (struct MeshChannel *ch, struct MeshClient *c) | 2505 | channel_add_client (struct MeshChannel *ch, struct MeshClient *c) |
2489 | { | 2506 | { |
2490 | if (NULL != t->client) | 2507 | if (NULL != ch->client) |
2491 | { | 2508 | { |
2492 | GNUNET_break(0); | 2509 | GNUNET_break(0); |
2493 | return; | 2510 | return; |
2494 | } | 2511 | } |
2495 | if (GNUNET_OK != | 2512 | if (GNUNET_OK != |
2496 | GNUNET_CONTAINER_multihashmap32_put (c->incoming_tunnels, | 2513 | GNUNET_CONTAINER_multihashmap32_put (c->incoming_channels, |
2497 | t->local_tid_dest, t, | 2514 | ch->id_dest, ch, |
2498 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 2515 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
2499 | { | 2516 | { |
2500 | GNUNET_break (0); | 2517 | GNUNET_break (0); |
2501 | return; | 2518 | return; |
2502 | } | 2519 | } |
2503 | if (GNUNET_OK != | 2520 | ch->client = c; |
2504 | GNUNET_CONTAINER_multihashmap32_put (incoming_tunnels, | ||
2505 | t->local_tid_dest, t, | ||
2506 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
2507 | { | ||
2508 | GNUNET_break (0); | ||
2509 | return; | ||
2510 | } | ||
2511 | t->client = c; | ||
2512 | } | 2521 | } |
2513 | 2522 | ||
2514 | 2523 | ||
@@ -2527,7 +2536,7 @@ tunnel_use_path (struct MeshTunnel2 *t, struct MeshPeerPath *p) | |||
2527 | if (own_pos > p->length - 1) | 2536 | if (own_pos > p->length - 1) |
2528 | { | 2537 | { |
2529 | GNUNET_break (0); | 2538 | GNUNET_break (0); |
2530 | return; | 2539 | return NULL; |
2531 | } | 2540 | } |
2532 | c->own_pos = own_pos; | 2541 | c->own_pos = own_pos; |
2533 | c->path = p; | 2542 | c->path = p; |
@@ -2559,7 +2568,7 @@ tunnel_use_path (struct MeshTunnel2 *t, struct MeshPeerPath *p) | |||
2559 | * 0 if the tunnel remained unaffected. | 2568 | * 0 if the tunnel remained unaffected. |
2560 | */ | 2569 | */ |
2561 | static GNUNET_PEER_Id | 2570 | static GNUNET_PEER_Id |
2562 | tunnel_notify_connection_broken (MeshTunnel2* t, | 2571 | tunnel_notify_connection_broken (struct MeshTunnel2* t, |
2563 | GNUNET_PEER_Id p1, GNUNET_PEER_Id p2) | 2572 | GNUNET_PEER_Id p1, GNUNET_PEER_Id p2) |
2564 | { | 2573 | { |
2565 | // if (myid != p1 && myid != p2) FIXME | 2574 | // if (myid != p1 && myid != p2) FIXME |
@@ -2601,21 +2610,20 @@ channel_send_data_ack (struct MeshChannel *ch, int fwd) | |||
2601 | uint64_t mask; | 2610 | uint64_t mask; |
2602 | unsigned int delta; | 2611 | unsigned int delta; |
2603 | 2612 | ||
2613 | if (GNUNET_NO == ch->reliable) | ||
2614 | { | ||
2615 | GNUNET_break (0); | ||
2616 | return; | ||
2617 | } | ||
2604 | rel = fwd ? ch->bck_rel : ch->fwd_rel; | 2618 | rel = fwd ? ch->bck_rel : ch->fwd_rel; |
2605 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2619 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2606 | "send_data_ack for %u\n", | 2620 | "send_data_ack for %u\n", |
2607 | rel->mid_recv - 1); | 2621 | rel->mid_recv - 1); |
2608 | 2622 | ||
2609 | if (GNUNET_NO == ch->reliable) | ||
2610 | { | ||
2611 | GNUNET_break_op (0); | ||
2612 | return; | ||
2613 | } | ||
2614 | msg.header.type = htons (fwd ? GNUNET_MESSAGE_TYPE_MESH_UNICAST_ACK : | 2623 | msg.header.type = htons (fwd ? GNUNET_MESSAGE_TYPE_MESH_UNICAST_ACK : |
2615 | GNUNET_MESSAGE_TYPE_MESH_TO_ORIG_ACK); | 2624 | GNUNET_MESSAGE_TYPE_MESH_TO_ORIG_ACK); |
2616 | msg.header.size = htons (sizeof (msg)); | 2625 | msg.header.size = htons (sizeof (msg)); |
2617 | msg.tid = htonl (t->id.tid); | 2626 | msg.id = htonl (ch->id); |
2618 | GNUNET_PEER_resolve (t->id.oid, &msg.oid); | ||
2619 | msg.mid = htonl (rel->mid_recv - 1); | 2627 | msg.mid = htonl (rel->mid_recv - 1); |
2620 | msg.futures = 0; | 2628 | msg.futures = 0; |
2621 | for (copy = rel->head_recv; NULL != copy; copy = copy->next) | 2629 | for (copy = rel->head_recv; NULL != copy; copy = copy->next) |
@@ -2631,7 +2639,7 @@ channel_send_data_ack (struct MeshChannel *ch, int fwd) | |||
2631 | } | 2639 | } |
2632 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " final futures %llX\n", msg.futures); | 2640 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " final futures %llX\n", msg.futures); |
2633 | 2641 | ||
2634 | send_prebuilt_message_tunnel (&msg.header, t, ch, fwd); | 2642 | send_prebuilt_message_channel (&msg.header, ch, fwd); |
2635 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "send_data_ack END\n"); | 2643 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "send_data_ack END\n"); |
2636 | } | 2644 | } |
2637 | 2645 | ||
diff --git a/src/mesh/mesh_protocol_enc.h b/src/mesh/mesh_protocol_enc.h index 6292bac40..cb3f6e719 100644 --- a/src/mesh/mesh_protocol_enc.h +++ b/src/mesh/mesh_protocol_enc.h | |||
@@ -144,14 +144,9 @@ struct GNUNET_MESH_DataACK | |||
144 | struct GNUNET_MessageHeader header; | 144 | struct GNUNET_MessageHeader header; |
145 | 145 | ||
146 | /** | 146 | /** |
147 | * TID of the tunnel | 147 | * ID of the channel |
148 | */ | 148 | */ |
149 | uint32_t tid GNUNET_PACKED; | 149 | uint32_t id GNUNET_PACKED; |
150 | |||
151 | /** | ||
152 | * OID of the tunnel | ||
153 | */ | ||
154 | struct GNUNET_PeerIdentity oid; | ||
155 | 150 | ||
156 | /** | 151 | /** |
157 | * Bitfield of already-received newer messages | 152 | * Bitfield of already-received newer messages |