[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30032 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30032 - gnunet/src/mesh |
Date: |
Wed, 9 Oct 2013 10:57:48 +0200 |
Author: bartpolot
Date: 2013-10-09 10:57:48 +0200 (Wed, 09 Oct 2013)
New Revision: 30032
Modified:
gnunet/src/mesh/gnunet-service-mesh_channel.c
gnunet/src/mesh/gnunet-service-mesh_local.c
gnunet/src/mesh/gnunet-service-mesh_local.h
Log:
- move get channel to local
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-10-09 08:53:21 UTC
(rev 30031)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-10-09 08:57:48 UTC
(rev 30032)
@@ -339,30 +339,6 @@
/**
- * Search for a channel among the channels for a client
- *
- * @param c the client whose channels to search in
- * @param chid the local id of the channel
- *
- * @return channel handler, NULL if doesn't exist
- */
-static struct MeshChannel *
-channel_get_by_local_id (struct MeshClient *c, MESH_ChannelNumber chid)
-{
- LOG (GNUNET_ERROR_TYPE_DEBUG, " -- get CHID %X\n", chid);
- if (0 == (chid & GNUNET_MESH_LOCAL_CHANNEL_ID_CLI))
- {
- GNUNET_break_op (0);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "CHID %X not a local chid\n", chid);
- return NULL;
- }
- if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV)
- return GNUNET_CONTAINER_multihashmap32_get (c->incoming_channels, chid);
- return GNUNET_CONTAINER_multihashmap32_get (c->own_channels, chid);
-}
-
-
-/**
* Add a client to a channel, initializing all needed data structures.
*
* @param ch Channel to which add the client.
@@ -380,7 +356,7 @@
}
/* Assign local id as destination */
- while (NULL != channel_get_by_local_id (c, t->next_local_chid))
+ while (NULL != GML_channel_get (c, t->next_local_chid))
t->next_local_chid = (t->next_local_chid + 1) |
GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
ch->lid_dest = t->next_local_chid++;
t->next_local_chid = t->next_local_chid | GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
@@ -985,7 +961,7 @@
peer2s (ch->t->peer),
ch->gid);
- if (channel_is_terminal (ch, GNUNET_NO))
+ if (GMCH_is_terminal (ch, GNUNET_NO))
{
if (NULL != ch->root && GNUNET_NO == ch->root->shutting_down)
{
@@ -999,7 +975,7 @@
GMCH_send_prebuilt_message (&msg.header, ch, GNUNET_NO);
}
- if (channel_is_terminal (ch, GNUNET_YES))
+ if (GMCH_is_terminal (ch, GNUNET_YES))
{
if (NULL != ch->dest && GNUNET_NO == ch->dest->shutting_down)
{
@@ -1574,7 +1550,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " %s\n",
GNUNET_MESH_DEBUG_M2S (ntohs (message->type)));
- if (channel_is_terminal (ch, fwd) || ch->t->peer->id == myid)
+ if (GMCH_is_terminal (ch, fwd) || ch->t->peer->id == myid)
{
GMT_handle_decrypted (ch->t, message, fwd);
return;
Modified: gnunet/src/mesh/gnunet-service-mesh_local.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_local.c 2013-10-09 08:53:21 UTC (rev
30031)
+++ gnunet/src/mesh/gnunet-service-mesh_local.c 2013-10-09 08:57:48 UTC (rev
30032)
@@ -848,6 +848,27 @@
}
}
+/**
+ * Get a chennel from a client
+ *
+ * @param c the client to check
+ * @param chid Channel ID, must be local (> 0x800...)
+ *
+ * @return non-NULL if channel exists in the clients lists
+ */
+struct MeshChannel *
+GML_channel_get (struct MeshClient *c, MESH_ChannelNumber chid)
+{
+ if (0 == (chid & GNUNET_MESH_LOCAL_CHANNEL_ID_CLI))
+ {
+ GNUNET_break_op (0);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "CHID %X not a local chid\n", chid);
+ return NULL;
+ }
+ if (chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV)
+ return GNUNET_CONTAINER_multihashmap32_get (c->incoming_channels, chid);
+ return GNUNET_CONTAINER_multihashmap32_get (c->own_channels, chid);
+}
/**
* Check if client has registered with the service and has not disconnected
Modified: gnunet/src/mesh/gnunet-service-mesh_local.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_local.h 2013-10-09 08:53:21 UTC (rev
30031)
+++ gnunet/src/mesh/gnunet-service-mesh_local.h 2013-10-09 08:57:48 UTC (rev
30032)
@@ -72,6 +72,17 @@
GML_shutdown (void);
/**
+ * Get a chennel from a client
+ *
+ * @param client the client to check
+ * @param chid Channel ID
+ *
+ * @return non-NULL if channel exists in the global DLL
+ */
+struct MeshChannel *
+GML_channel_get (struct MeshClient *client, uint32_t chid);
+
+/**
* Check if client has registered with the service and has not disconnected
*
* @param client the client to check
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30032 - gnunet/src/mesh,
gnunet <=