[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28351 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28351 - gnunet/src/mesh |
Date: |
Thu, 1 Aug 2013 16:11:28 +0200 |
Author: bartpolot
Date: 2013-08-01 16:11:28 +0200 (Thu, 01 Aug 2013)
New Revision: 28351
Modified:
gnunet/src/mesh/gnunet-service-mesh-enc.c
gnunet/src/mesh/mesh_protocol_enc.h
Log:
- channel messages do not include tunnel info
Modified: gnunet/src/mesh/gnunet-service-mesh-enc.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh-enc.c 2013-08-01 12:25:15 UTC (rev
28350)
+++ gnunet/src/mesh/gnunet-service-mesh-enc.c 2013-08-01 14:11:28 UTC (rev
28351)
@@ -1268,7 +1268,7 @@
return;
msg.header.size = htons (sizeof (msg));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_CREATE);
- msg.channel_id = htonl (ch->local_tid_dest);
+ msg.channel_id = htonl (ch->id_dest);
msg.port = htonl (ch->port);
msg.opt = 0;
msg.opt |= GNUNET_YES == ch->reliable ? GNUNET_MESH_OPTION_RELIABLE : 0;
@@ -1456,6 +1456,23 @@
/**
+ * Sends an already built message on a channel, properly registering
+ * all used resources.
+ *
+ * @param message Message to send. Function makes a copy of it.
+ * @param ch Channel on which this message is transmitted.
+ * @param fwd Is this a fwd message?
+ */
+static void
+send_prebuilt_message_channel (const struct GNUNET_MessageHeader *message,
+ struct MeshChannel *ch,
+ int fwd)
+{
+ send_prebuilt_message_tunnel (message, ch->t, ch, fwd);
+}
+
+
+/**
* Sends an already built message directly to a peer.
*
* @param message Message to send. Function makes a copy of it.
@@ -2479,7 +2496,7 @@
/**
- * Add a client to a tunnel, initializing all needed data structures.
+ * Add a client to a channel, initializing all needed data structures.
*
* @param ch Channel to which add the client.
* @param c Client which to add to the channel.
@@ -2487,28 +2504,20 @@
static void
channel_add_client (struct MeshChannel *ch, struct MeshClient *c)
{
- if (NULL != t->client)
+ if (NULL != ch->client)
{
GNUNET_break(0);
return;
}
if (GNUNET_OK !=
- GNUNET_CONTAINER_multihashmap32_put (c->incoming_tunnels,
- t->local_tid_dest, t,
+ GNUNET_CONTAINER_multihashmap32_put (c->incoming_channels,
+ ch->id_dest, ch,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
{
GNUNET_break (0);
return;
}
- if (GNUNET_OK !=
- GNUNET_CONTAINER_multihashmap32_put (incoming_tunnels,
- t->local_tid_dest, t,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
- {
- GNUNET_break (0);
- return;
- }
- t->client = c;
+ ch->client = c;
}
@@ -2527,7 +2536,7 @@
if (own_pos > p->length - 1)
{
GNUNET_break (0);
- return;
+ return NULL;
}
c->own_pos = own_pos;
c->path = p;
@@ -2559,7 +2568,7 @@
* 0 if the tunnel remained unaffected.
*/
static GNUNET_PEER_Id
-tunnel_notify_connection_broken (MeshTunnel2* t,
+tunnel_notify_connection_broken (struct MeshTunnel2* t,
GNUNET_PEER_Id p1, GNUNET_PEER_Id p2)
{
// if (myid != p1 && myid != p2) FIXME
@@ -2601,21 +2610,20 @@
uint64_t mask;
unsigned int delta;
+ if (GNUNET_NO == ch->reliable)
+ {
+ GNUNET_break (0);
+ return;
+ }
rel = fwd ? ch->bck_rel : ch->fwd_rel;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"send_data_ack for %u\n",
rel->mid_recv - 1);
- if (GNUNET_NO == ch->reliable)
- {
- GNUNET_break_op (0);
- return;
- }
msg.header.type = htons (fwd ? GNUNET_MESSAGE_TYPE_MESH_UNICAST_ACK :
GNUNET_MESSAGE_TYPE_MESH_TO_ORIG_ACK);
msg.header.size = htons (sizeof (msg));
- msg.tid = htonl (t->id.tid);
- GNUNET_PEER_resolve (t->id.oid, &msg.oid);
+ msg.id = htonl (ch->id);
msg.mid = htonl (rel->mid_recv - 1);
msg.futures = 0;
for (copy = rel->head_recv; NULL != copy; copy = copy->next)
@@ -2631,7 +2639,7 @@
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " final futures %llX\n", msg.futures);
- send_prebuilt_message_tunnel (&msg.header, t, ch, fwd);
+ send_prebuilt_message_channel (&msg.header, ch, fwd);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "send_data_ack END\n");
}
Modified: gnunet/src/mesh/mesh_protocol_enc.h
===================================================================
--- gnunet/src/mesh/mesh_protocol_enc.h 2013-08-01 12:25:15 UTC (rev 28350)
+++ gnunet/src/mesh/mesh_protocol_enc.h 2013-08-01 14:11:28 UTC (rev 28351)
@@ -144,16 +144,11 @@
struct GNUNET_MessageHeader header;
/**
- * TID of the tunnel
+ * ID of the channel
*/
- uint32_t tid GNUNET_PACKED;
+ uint32_t id GNUNET_PACKED;
/**
- * OID of the tunnel
- */
- struct GNUNET_PeerIdentity oid;
-
- /**
* Bitfield of already-received newer messages
* pid + 1 @ LSB
* pid + 64 @ MSB
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28351 - gnunet/src/mesh,
gnunet <=