[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30128 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30128 - gnunet/src/mesh |
Date: |
Fri, 11 Oct 2013 11:33:37 +0200 |
Author: bartpolot
Date: 2013-10-11 11:33:36 +0200 (Fri, 11 Oct 2013)
New Revision: 30128
Modified:
gnunet/src/mesh/gnunet-service-mesh_channel.c
gnunet/src/mesh/gnunet-service-mesh_channel.h
gnunet/src/mesh/gnunet-service-mesh_local.c
Log:
- sync
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-10-11 07:57:13 UTC
(rev 30127)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-10-11 09:33:36 UTC
(rev 30128)
@@ -684,13 +684,12 @@
*
* @param ch Channel on which to empty the message buffer.
* @param c Client to send to.
- * @param rel Reliability structure to corresponding peer.
- * If rel == bck_rel, this is FWD data.
+ * @param fwd Is this to send FWD data?.
*/
static void
send_client_buffered_data (struct MeshChannel *ch,
- struct MeshClient *c,
- int fwd)
+ struct MeshClient *c,
+ int fwd)
{
struct MeshReliableMessage *copy;
struct MeshChannelReliability *rel;
@@ -1186,6 +1185,55 @@
/**
+ * Handle an ACK given by a client.
+ *
+ * Mark client as ready and send him any buffered data we could have for him.
+ *
+ * @param ch Channel.
+ * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by root and go BCK)
+ */
+void
+GMCH_handle_local_ack (struct MeshChannel *ch, int fwd)
+{
+ struct MeshChannelReliability *rel;
+ struct MeshClient *c;
+
+ rel = fwd ? ch->dest_rel : ch->root_rel;
+ c = fwd ? ch->dest : ch->root;
+
+ rel->client_ready = GNUNET_YES;
+ send_client_buffered_data (ch, c, fwd);
+ send_ack (NULL, ch, fwd);
+
+}
+
+
+/**
+ * Handle data given by a client.
+ *
+ * @param ch Channel.
+ * @param fwd Is this a FWD data?
+ */
+void
+GMCH_handle_local_data (struct MeshChannel *ch,
+ struct MeshClient *c,
+ int fwd)
+{
+ /* Is the client in the channel? */
+ if ( !( (fwd &&
+ ch->root == c)
+ ||
+ (!fwd &&
+ ch->dest == c) ) )
+ {
+ GNUNET_break (0);
+ GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ return;
+ }
+}
+
+
+/**
* Handler for mesh network payload traffic.
*
* @param ch Channel for the message.
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.h 2013-10-11 07:57:13 UTC
(rev 30127)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.h 2013-10-11 09:33:36 UTC
(rev 30128)
@@ -139,7 +139,6 @@
void
GMCH_send_create (struct MeshChannel *ch);
-
/**
* Notify a client that the channel is no longer valid.
*
@@ -148,7 +147,6 @@
void
GMCH_send_destroy (struct MeshChannel *ch);
-
/**
* Log channel info.
*
@@ -157,6 +155,16 @@
void
GMCH_debug (struct MeshChannel *ch);
+/**
+ * Handle an ACK given by a client.
+ *
+ * Mark client as ready and send him any buffered data we could have for him.
+ *
+ * @param ch Channel.
+ * @param fwd Is this a "FWD ACK"? (FWD ACKs are sent by root and go BCK)
+ */
+void
+GMCH_handle_local_ack (struct MeshChannel *ch, int fwd);
/**
* Handler for mesh network payload traffic.
@@ -170,7 +178,6 @@
const struct GNUNET_MESH_Data *msg,
int fwd);
-
/**
* Handler for mesh network traffic end-to-end ACKs.
*
@@ -183,7 +190,6 @@
const struct GNUNET_MESH_DataACK *msg,
int fwd);
-
/**
* Handler for channel create messages.
*
@@ -195,7 +201,6 @@
GMCH_handle_create (const struct GNUNET_MESH_ChannelCreate *msg,
int fwd);
-
/**
* Handler for channel ack messages.
*
@@ -208,7 +213,6 @@
const struct GNUNET_MESH_ChannelManage *msg,
int fwd);
-
/**
* Handler for channel destroy messages.
*
@@ -221,8 +225,6 @@
const struct GNUNET_MESH_ChannelManage *msg,
int fwd);
-
-
/**
* Sends an already built message on a channel, properly registering
* all used resources and encrypting the message with the tunnel's key.
Modified: gnunet/src/mesh/gnunet-service-mesh_local.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_local.c 2013-10-11 07:57:13 UTC (rev
30127)
+++ gnunet/src/mesh/gnunet-service-mesh_local.c 2013-10-11 09:33:36 UTC (rev
30128)
@@ -521,7 +521,7 @@
"Got data from a client!\n");
/* Sanity check for client registration */
- if (NULL == (c = client_get (client)))
+ if (NULL == (c = GML_client_get (client)))
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -543,7 +543,7 @@
/* Channel exists? */
chid = ntohl (msg->id);
fwd = chid < GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
- ch = channel_get_by_local_id (c, chid);
+ ch = GML_channel_get (c, chid);
if (NULL == ch)
{
GNUNET_break (0);
@@ -551,20 +551,6 @@
return;
}
- /* Is the client in the channel? */
- if ( !( (fwd &&
- ch->root &&
- ch->root->handle == client)
- ||
- (!fwd &&
- ch->dest &&
- ch->dest->handle == client) ) )
- {
- GNUNET_break (0);
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
- return;
- }
-
rel = fwd ? ch->root_rel : ch->dest_rel;
rel->client_ready = GNUNET_NO;
@@ -608,7 +594,6 @@
const struct GNUNET_MessageHeader *message)
{
struct GNUNET_MESH_LocalAck *msg;
- struct MeshChannelReliability *rel;
struct MeshChannel *ch;
struct MeshClient *c;
MESH_ChannelNumber chid;
@@ -617,7 +602,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, "Got a local ACK\n");
/* Sanity check for client registration */
- if (NULL == (c = client_get (client)))
+ if (NULL == (c = GML_client_get (client)))
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -630,7 +615,7 @@
/* Channel exists? */
chid = ntohl (msg->channel_id);
LOG (GNUNET_ERROR_TYPE_DEBUG, " on channel %X\n", chid);
- ch = channel_get_by_local_id (c, chid);
+ ch = GML_channel_get (c, chid);
LOG (GNUNET_ERROR_TYPE_DEBUG, " -- ch %p\n", ch);
if (NULL == ch)
{
@@ -644,13 +629,9 @@
/* If client is root, the ACK is going FWD, therefore this is "BCK". */
/* If client is dest, the ACK is going BCK, therefore this is "FWD" */
fwd = chid >= GNUNET_MESH_LOCAL_CHANNEL_ID_SERV;
- rel = fwd ? ch->dest_rel : ch->root_rel;
- rel->client_ready = GNUNET_YES;
- channel_send_client_buffered_data (ch, c, fwd);
- send_ack (NULL, ch, fwd);
-
GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ GMCH_handle_local_ack (ch, fwd);
return;
}
@@ -703,7 +684,7 @@
struct MeshClient *c;
/* Sanity check for client registration */
- if (NULL == (c = client_get (client)))
+ if (NULL == (c = GML_client_get (client)))
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -740,7 +721,7 @@
struct MeshChannel *ch;
/* Sanity check for client registration */
- if (NULL == (c = client_get (client)))
+ if (NULL == (c = GML_client_get (client)))
{
GNUNET_break (0);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30128 - gnunet/src/mesh,
gnunet <=