[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23925 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23925 - gnunet/src/mesh |
Date: |
Thu, 20 Sep 2012 15:54:57 +0200 |
Author: bartpolot
Date: 2012-09-20 15:54:57 +0200 (Thu, 20 Sep 2012)
New Revision: 23925
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
Log:
- delete deprected parameters, update doc
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2012-09-20 13:49:39 UTC (rev
23924)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2012-09-20 13:54:57 UTC (rev
23925)
@@ -1167,9 +1167,17 @@
/**
- * Queue and pass message to core when possible.
+ * @brief Queue and pass message to core when possible.
+ *
+ * If type is payload (UNICAST, TO_ORIGIN, MULTICAST) checks for queue status
+ * and accounts for it. In case the queue is full, the message is dropped and
+ * a break issued.
+ *
+ * Otherwise, message is treated as internal and allowed to go regardless of
+ * queue status.
*
- * @param cls Closure (type dependant).
+ * @param cls Closure (@c type dependant). It will be used by queue_send to
+ * build the message to be sent if not already prebuilt.
* @param type Type of the message, 0 for a raw message.
* @param size Size of the message.
* @param dst Neighbor to send message to.
@@ -2303,9 +2311,9 @@
* @param t Tunnel on which this message is transmitted.
*/
static void
-send_message (const struct GNUNET_MessageHeader *message,
- const struct GNUNET_PeerIdentity *peer,
- struct MeshTunnel *t)
+send_prebuilt_message (const struct GNUNET_MessageHeader *message,
+ const struct GNUNET_PeerIdentity *peer,
+ struct MeshTunnel *t)
{
struct MeshTransmissionDescriptor *info;
struct MeshPeerInfo *neighbor;
@@ -2480,7 +2488,7 @@
{
GNUNET_PEER_resolve (p->peers[i], &pi[i]);
}
- send_message (&msg->header, tree_get_first_hop (t->tree, destination), t);
+ send_prebuilt_message (&msg->header, tree_get_first_hop (t->tree,
destination), t);
}
path_destroy (p);
}
@@ -3306,7 +3314,7 @@
msg.peer1 = my_full_id;
GNUNET_PEER_resolve (pid, &msg.peer2);
GNUNET_PEER_resolve (tree_get_predecessor (t->tree), &neighbor);
- send_message (&msg.header, &neighbor, t);
+ send_prebuilt_message (&msg.header, &neighbor, t);
}
}
return pid;
@@ -3325,6 +3333,7 @@
struct MeshData *mdata = cls;
struct MeshTransmissionDescriptor *info;
struct GNUNET_PeerIdentity neighbor;
+ struct GNUNET_MessageHeader *msg;
info = GNUNET_malloc (sizeof (struct MeshTransmissionDescriptor));
@@ -3336,8 +3345,9 @@
GNUNET_i2s (&neighbor));
info->peer = peer_info_get (&neighbor);
GNUNET_assert (NULL != info->peer);
+ msg = (struct GNUNET_MessageHeader *) mdata->data;
queue_add(info,
- GNUNET_MESSAGE_TYPE_MESH_MULTICAST,
+ ntohs (msg->type),
info->mesh_data->data_len,
info->peer,
mdata->t);
@@ -3350,14 +3360,10 @@
*
* @param t Tunnel in which to send the data.
* @param msg Message to be sent.
- * @param internal DEPRECATED Has the service generated this message?
- *
- * FIXME remove internal if no use comes up
*/
static void
tunnel_send_multicast (struct MeshTunnel *t,
- const struct GNUNET_MessageHeader *msg,
- int internal)
+ const struct GNUNET_MessageHeader *msg)
{
struct MeshData *mdata;
@@ -3744,7 +3750,7 @@
msg.pid = htonl (ack);
msg.tid = htonl (t->id.tid);
- send_message (&msg.header, peer, t);
+ send_prebuilt_message (&msg.header, peer, t);
}
@@ -4059,7 +4065,7 @@
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY);
GNUNET_PEER_resolve (t->id.oid, &msg.oid);
msg.tid = htonl (t->id.tid);
- tunnel_send_multicast (t, &msg.header, GNUNET_NO);
+ tunnel_send_multicast (t, &msg.header);
}
@@ -4855,7 +4861,8 @@
* Otherwise, message is treated as internal and allowed to go regardless of
* queue status.
*
- * @param cls Closure (type dependant).
+ * @param cls Closure (@c type dependant). It will be used by queue_send to
+ * build the message to be sent if not already prebuilt.
* @param type Type of the message, 0 for a raw message.
* @param size Size of the message.
* @param dst Neighbor to send message to.
@@ -5117,6 +5124,7 @@
info->origin = &t->id;
info->peer = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey);
GNUNET_assert (NULL != info->peer);
+ // FIXME don't use queue_add directly, abstact in a send_message_* funcion
queue_add(info,
GNUNET_MESSAGE_TYPE_MESH_PATH_ACK,
sizeof (struct GNUNET_MESH_PathACK),
@@ -5213,7 +5221,7 @@
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " Own position: %u\n", own_pos);
if (own_pos < path->length - 1)
- send_message (message, &pi[own_pos + 1], t);
+ send_prebuilt_message (message, &pi[own_pos + 1], t);
else
send_client_tunnel_disconnect(t, NULL);
@@ -5431,7 +5439,7 @@
GNUNET_break_op (0);
return GNUNET_OK;
}
- send_message (message, neighbor, t);
+ send_prebuilt_message (message, neighbor, t);
GNUNET_STATISTICS_update (stats, "# unicast forwarded", 1, GNUNET_NO);
return GNUNET_OK;
}
@@ -5516,7 +5524,7 @@
return GNUNET_OK;
}
GNUNET_STATISTICS_update (stats, "# multicast forwarded", 1, GNUNET_NO);
- tunnel_send_multicast (t, message, GNUNET_NO);
+ tunnel_send_multicast (t, message);
return GNUNET_OK;
}
@@ -5596,7 +5604,7 @@
return GNUNET_OK;
}
GNUNET_PEER_resolve (tree_get_predecessor (t->tree), &id);
- send_message (message, &id, t);
+ send_prebuilt_message (message, &id, t);
GNUNET_STATISTICS_update (stats, "# to origin forwarded", 1, GNUNET_NO);
return GNUNET_OK;
@@ -5760,7 +5768,7 @@
GNUNET_break (0);
return GNUNET_OK;
}
- send_message (message, &id, t);
+ send_prebuilt_message (message, &id, t);
return GNUNET_OK;
}
@@ -5804,7 +5812,7 @@
tunnel_reset_timeout (t);
GNUNET_STATISTICS_update (stats, "# keepalives forwarded", 1, GNUNET_NO);
- tunnel_send_multicast (t, message, GNUNET_NO);
+ tunnel_send_multicast (t, message);
return GNUNET_OK;
}
@@ -5924,7 +5932,7 @@
msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_KEEPALIVE);
msg->oid = my_full_id;
msg->tid = htonl (t->id.tid);
- tunnel_send_multicast (t, &msg->header, GNUNET_YES);
+ tunnel_send_multicast (t, &msg->header);
t->path_refresh_task =
GNUNET_SCHEDULER_add_delayed (refresh_path_time, &path_refresh, t);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23925 - gnunet/src/mesh,
gnunet <=