[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30555 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30555 - gnunet/src/mesh |
Date: |
Wed, 6 Nov 2013 01:36:45 +0100 |
Author: bartpolot
Date: 2013-11-06 01:36:45 +0100 (Wed, 06 Nov 2013)
New Revision: 30555
Modified:
gnunet/src/mesh/gnunet-service-mesh_channel.c
gnunet/src/mesh/gnunet-service-mesh_connection.c
gnunet/src/mesh/gnunet-service-mesh_tunnel.c
gnunet/src/mesh/gnunet-service-mesh_tunnel.h
Log:
- fixes
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-11-05 22:44:07 UTC
(rev 30554)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c 2013-11-06 00:36:45 UTC
(rev 30555)
@@ -1439,7 +1439,7 @@
msgcc.port = msg->port;
msgcc.opt = msg->opt;
- GMT_queue_data (t, ch, &msgcc.header, GNUNET_YES);
+ GMT_send_prebuilt_message (&msgcc.header, t, ch, GNUNET_YES);
}
return GNUNET_OK;
}
Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c 2013-11-05 22:44:07 UTC
(rev 30554)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c 2013-11-06 00:36:45 UTC
(rev 30555)
@@ -1214,7 +1214,6 @@
connection_change_state (c, MESH_CONNECTION_READY);
GMT_change_state (c->t, MESH_TUNNEL3_READY);
send_connection_ack (c, GNUNET_YES);
- GMT_send_queued_data (c->t, GNUNET_YES);
return GNUNET_OK;
}
@@ -1224,7 +1223,6 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " Connection ACK for us!\n");
connection_change_state (c, MESH_CONNECTION_READY);
GMT_change_state (c->t, MESH_TUNNEL3_READY);
- GMT_send_queued_data (c->t, GNUNET_NO);
return GNUNET_OK;
}
Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2013-11-05 22:44:07 UTC
(rev 30554)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2013-11-06 00:36:45 UTC
(rev 30555)
@@ -447,6 +447,81 @@
/**
+ * Send all cached messages that we can, tunnel is online.
+ *
+ * @param t Tunnel that holds the messages.
+ * @param fwd Is this fwd?
+ */
+static void
+send_queued_data (struct MeshTunnel3 *t, int fwd)
+{
+ struct MeshTunnelQueue *tq;
+ struct MeshTunnelQueue *next;
+ unsigned int room;
+
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "GMT_send_queued_data on tunnel %s\n",
+ GMT_2s (t));
+
+ if (NULL == t->channel_head ||
+ GNUNET_NO == GMCH_is_origin (t->channel_head->ch, fwd))
+ return;
+
+ room = GMT_get_buffer (t, fwd);
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer space: %u\n", room);
+ for (tq = t->tq_head; NULL != tq && room > 0; tq = next)
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " data on channel %s\n", GMCH_2s (tq->ch));
+ next = tq->next;
+ room--;
+ GNUNET_CONTAINER_DLL_remove (t->tq_head, t->tq_tail, tq);
+ GMCH_send_prebuilt_message ((struct GNUNET_MessageHeader *) &tq[1],
+ tq->ch, fwd);
+
+ GNUNET_free (tq);
+ }
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "GMT_send_queued_data end\n",
+ GMP_2s (t->peer));
+}
+
+
+
+
+/**
+ * Cache a message to be sent once tunnel is online.
+ *
+ * @param t Tunnel to hold the message.
+ * @param ch Channel the message is about.
+ * @param msg Message itself (copy will be made).
+ * @param fwd Is this fwd?
+ */
+static void
+queue_data (struct MeshTunnel3 *t,
+ struct MeshChannel *ch,
+ const struct GNUNET_MessageHeader *msg,
+ int fwd)
+{
+ struct MeshTunnelQueue *tq;
+ uint16_t size = ntohs (msg->size);
+
+ if (MESH_TUNNEL3_READY == t->state)
+ {
+ GNUNET_break (0);
+ GMT_send_prebuilt_message (msg, t, ch, fwd);
+ return;
+ }
+
+ tq = GNUNET_malloc (sizeof (struct MeshTunnelQueue) + size);
+
+ tq->ch = ch;
+ memcpy (&tq[1], msg, size);
+ GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, t->tq_tail, tq);
+}
+
+
+
+/**
* Send the ephemeral key on a tunnel.
*
* @param t Tunnel on which to send the key.
@@ -964,71 +1039,7 @@
}
-
/**
- * Cache a message to be sent once tunnel is online.
- *
- * @param t Tunnel to hold the message.
- * @param ch Channel the message is about.
- * @param msg Message itself (copy will be made).
- * @param fwd Is this fwd?
- */
-void
-GMT_queue_data (struct MeshTunnel3 *t,
- struct MeshChannel *ch,
- struct GNUNET_MessageHeader *msg,
- int fwd)
-{
- struct MeshTunnelQueue *tq;
- uint16_t size = ntohs (msg->size);
-
- tq = GNUNET_malloc (sizeof (struct MeshTunnelQueue) + size);
-
- tq->ch = ch;
- memcpy (&tq[1], msg, size);
- GNUNET_CONTAINER_DLL_insert_tail (t->tq_head, t->tq_tail, tq);
-
- if (MESH_TUNNEL3_READY == t->state)
- GMT_send_queued_data (t, fwd);
-}
-
-
-/**
- * Send all cached messages that we can, tunnel is online.
- *
- * @param t Tunnel that holds the messages.
- * @param fwd Is this fwd?
- */
-void
-GMT_send_queued_data (struct MeshTunnel3 *t, int fwd)
-{
- struct MeshTunnelQueue *tq;
- struct MeshTunnelQueue *next;
- unsigned int room;
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "GMT_send_queued_data on tunnel %s\n",
- GMT_2s (t));
- room = GMT_get_buffer (t, fwd);
- LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer space: %u\n", room);
- for (tq = t->tq_head; NULL != tq && room > 0; tq = next)
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG, " data on channel %s\n", GMCH_2s (tq->ch));
- next = tq->next;
- room--;
- GNUNET_CONTAINER_DLL_remove (t->tq_head, t->tq_tail, tq);
- GMCH_send_prebuilt_message ((struct GNUNET_MessageHeader *) &tq[1],
- tq->ch, fwd);
-
- GNUNET_free (tq);
- }
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "GMT_send_queued_data end\n",
- GMP_2s (t->peer));
-}
-
-
-/**
* Initialize the tunnel subsystem.
*
* @param c Configuration handle.
@@ -1126,6 +1137,11 @@
"Tunnel %s state is now %s\n",
GMP_2s (t->peer),
GMT_state2s (state));
+ if (MESH_TUNNEL3_WAITING == t->state)
+ {
+ send_queued_data (t, GNUNET_YES);
+ send_queued_data (t, GNUNET_NO);
+ }
t->state = state;
if (MESH_TUNNEL3_READY == state && 3 <= GMT_count_connections (t))
{
@@ -1672,6 +1688,11 @@
uint64_t iv;
uint16_t type;
+ if (MESH_TUNNEL3_READY != t->state)
+ {
+ queue_data (t, ch, message, fwd);
+ return;
+ }
LOG (GNUNET_ERROR_TYPE_DEBUG, "GMT Send on Tunnel %s\n", GMT_2s (t));
iv = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_NONCE, UINT64_MAX);
Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.h 2013-11-05 22:44:07 UTC
(rev 30554)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.h 2013-11-06 00:36:45 UTC
(rev 30555)
@@ -238,29 +238,6 @@
const struct GNUNET_MessageHeader *message);
/**
- * Cache a message to be sent once tunnel is online.
- *
- * @param t Tunnel to hold the message.
- * @param ch Channel the message is about.
- * @param msg Message itself (copy will be made).
- * @param fwd Is this fwd?
- */
-void
-GMT_queue_data (struct MeshTunnel3 *t,
- struct MeshChannel *ch,
- struct GNUNET_MessageHeader *msg,
- int fwd);
-
-/**
- * Send all cached messages that we can, tunnel is online.
- *
- * @param t Tunnel that holds the messages.
- * @param fwd Is this fwd?
- */
-void
-GMT_send_queued_data (struct MeshTunnel3 *t, int fwd);
-
-/**
* @brief Use the given path for the tunnel.
* Update the next and prev hops (and RCs).
* (Re)start the path refresh in case the tunnel is locally owned.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30555 - gnunet/src/mesh,
gnunet <=