[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33047 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33047 - gnunet/src/mesh |
Date: |
Fri, 11 Apr 2014 19:01:26 +0200 |
Author: bartpolot
Date: 2014-04-11 19:01:26 +0200 (Fri, 11 Apr 2014)
New Revision: 33047
Modified:
gnunet/src/mesh/gnunet-service-mesh_channel.c
gnunet/src/mesh/gnunet-service-mesh_connection.c
gnunet/src/mesh/gnunet-service-mesh_connection.h
gnunet/src/mesh/gnunet-service-mesh_peer.c
gnunet/src/mesh/gnunet-service-mesh_peer.h
gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- more info in log about payload
Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c 2014-04-11 15:30:39 UTC
(rev 33046)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c 2014-04-11 17:01:26 UTC
(rev 33047)
@@ -1524,7 +1524,7 @@
}
rel = fwd ? ch->dest_rel : ch->root_rel;
ack = rel->mid_recv - 1;
- LOG (GNUNET_ERROR_TYPE_INFO, "=> DATA_ACK for %u\n", ack);
+ LOG (GNUNET_ERROR_TYPE_INFO, "===> DATA_ACK for %u\n", ack);
msg.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_DATA_ACK);
msg.header.size = htons (sizeof (msg));
@@ -1941,7 +1941,7 @@
GNUNET_STATISTICS_update (stats, "# data received", 1, GNUNET_NO);
mid = ntohl (msg->mid);
- LOG (GNUNET_ERROR_TYPE_INFO, "<= DATA %u %s on channel %s\n",
+ LOG (GNUNET_ERROR_TYPE_INFO, "<=== DATA %u %s on channel %s\n",
mid, GM_f2s (fwd), GMCH_2s (ch));
if (GNUNET_NO == ch->reliable ||
@@ -2020,7 +2020,7 @@
}
ack = ntohl (msg->mid);
- LOG (GNUNET_ERROR_TYPE_INFO, "<= %s ACK %u\n", GM_f2s (fwd), ack);
+ LOG (GNUNET_ERROR_TYPE_INFO, "<=== %s ACK %u\n", GM_f2s (fwd), ack);
if (GNUNET_YES == fwd)
{
@@ -2295,7 +2295,7 @@
uint16_t type;
type = ntohs (message->type);
- LOG (GNUNET_ERROR_TYPE_INFO, "=> %s %s on channel %s\n",
+ LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %s on channel %s\n",
GM_m2s (type), GM_f2s (fwd), GMCH_2s (ch));
if (GMT_is_loopback (ch->t))
@@ -2310,7 +2310,7 @@
case GNUNET_MESSAGE_TYPE_MESH_DATA:
payload = (struct GNUNET_MESH_Data *) message;
- LOG (GNUNET_ERROR_TYPE_INFO, "=> %s %u\n",
+ LOG (GNUNET_ERROR_TYPE_INFO, "===> %s %u\n",
GM_m2s (type), ntohl (payload->mid));
if (GNUNET_YES == ch->reliable)
{
Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c 2014-04-11 15:30:39 UTC
(rev 33046)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c 2014-04-11 17:01:26 UTC
(rev 33047)
@@ -549,8 +549,9 @@
msg.ack = htonl (ack);
msg.cid = c->id;
- prev_fc->ack_msg = GMC_send_prebuilt_message (&msg.header, c,
- !fwd, GNUNET_YES,
+ prev_fc->ack_msg = GMC_send_prebuilt_message (&msg.header,
+ GNUNET_MESSAGE_TYPE_MESH_ACK,
+ ack, c, !fwd, GNUNET_YES,
&ack_sent, prev_fc);
}
@@ -818,6 +819,7 @@
GM_f2s (!fwd), GMC_2s (connection));
GMP_queue_add (get_hop (connection, fwd), NULL,
GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK,
+ GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, 0,
sizeof (struct GNUNET_MESH_ConnectionACK),
connection, fwd, &message_sent, NULL);
connection->pending_messages++;
@@ -849,7 +851,9 @@
msg.cid = c->id;
msg.peer1 = *id1;
msg.peer2 = *id2;
- GMC_send_prebuilt_message (&msg.header, c, fwd, GNUNET_YES, NULL, NULL);
+ GMC_send_prebuilt_message (&msg.header,
+ GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN, 0,
+ c, fwd, GNUNET_YES, NULL, NULL);
}
@@ -883,6 +887,7 @@
neighbor = GMP_get_short (peer_id);
GMP_queue_add (neighbor, msg,
GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN,
+ GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN, 2,
sizeof (struct GNUNET_MESH_ConnectionBroken),
NULL, GNUNET_SYSERR, /* connection, fwd */
NULL, NULL); /* continuation */
@@ -1236,9 +1241,12 @@
msg.header.size = htons (sizeof (msg));
msg.pid = htonl (fc->last_pid_sent);
LOG (GNUNET_ERROR_TYPE_DEBUG, " *** last pid sent: %u!\n",
fc->last_pid_sent);
- fc->poll_msg = GMC_send_prebuilt_message (&msg.header, c,
- fc == &c->fwd_fc, GNUNET_YES,
- &poll_sent, fc);
+ fc->poll_msg =
+ GMC_send_prebuilt_message (&msg.header,
+ GNUNET_MESSAGE_TYPE_MESH_POLL,
+ fc->last_pid_sent,
+ c, fc == &c->fwd_fc, GNUNET_YES,
+ &poll_sent, fc);
}
@@ -1512,7 +1520,7 @@
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MESH_Hash *hash)
{
- LOG (GNUNET_ERROR_TYPE_INFO, "<- %s on connection %s from %s\n",
+ LOG (GNUNET_ERROR_TYPE_INFO, "<-- %s on connection %s from %s\n",
GM_m2s (ntohs (message->type)), GNUNET_h2s (GM_h2hc (hash)),
GNUNET_i2s (peer));
}
@@ -1640,7 +1648,9 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " Retransmitting.\n");
GMP_add_path (dest_peer, path_duplicate (path), GNUNET_NO);
GMP_add_path_to_origin (orig_peer, path_duplicate (path), GNUNET_NO);
- GMC_send_prebuilt_message (message, c, GNUNET_YES, GNUNET_YES,
+ GMC_send_prebuilt_message (message,
+ GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE, 0,
+ c, GNUNET_YES, GNUNET_YES,
NULL, NULL);
}
path_destroy (path);
@@ -1768,7 +1778,9 @@
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
- GMC_send_prebuilt_message (message, c, fwd, GNUNET_YES, NULL, NULL);
+ GMC_send_prebuilt_message (message,
+ GNUNET_MESSAGE_TYPE_MESH_CONNECTION_ACK, 0,
+ c, fwd, GNUNET_YES, NULL, NULL);
return GNUNET_OK;
}
@@ -1828,7 +1840,9 @@
}
else
{
- GMC_send_prebuilt_message (message, c, fwd, GNUNET_YES, NULL, NULL);
+ GMC_send_prebuilt_message (message,
+ GNUNET_MESSAGE_TYPE_MESH_CONNECTION_BROKEN, 0,
+ c, fwd, GNUNET_YES, NULL, NULL);
c->destroy = GNUNET_YES;
connection_cancel_queues (c, !fwd);
}
@@ -1877,10 +1891,12 @@
return GNUNET_OK;
}
if (GNUNET_NO == GMC_is_terminal (c, fwd))
- GMC_send_prebuilt_message (message, c, fwd, GNUNET_YES, NULL, NULL);
+ GMC_send_prebuilt_message (message,
+ GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY, 0,
+ c, fwd, GNUNET_YES, NULL, NULL);
else if (0 == c->pending_messages)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "! directly destroying connection!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, " directly destroying connection!\n");
GMC_destroy (c);
return GNUNET_OK;
}
@@ -2020,7 +2036,9 @@
}
GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO);
- GMC_send_prebuilt_message (&msg->header, c, fwd, GNUNET_NO, NULL, NULL);
+ GMC_send_prebuilt_message (&msg->header,
+ GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED, 0,
+ c, fwd, GNUNET_NO, NULL, NULL);
return GNUNET_OK;
}
@@ -2118,7 +2136,8 @@
/* Message not for us: forward to next hop */
LOG (GNUNET_ERROR_TYPE_DEBUG, " not for us, retransmitting...\n");
GNUNET_STATISTICS_update (stats, "# messages forwarded", 1, GNUNET_NO);
- GMC_send_prebuilt_message (&msg->header, c, fwd, GNUNET_NO, NULL, NULL);
+ GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_MESH_KX, 0,
+ c, fwd, GNUNET_NO, NULL, NULL);
return GNUNET_OK;
}
@@ -2827,6 +2846,7 @@
*
* @param message Message to send. Function makes a copy of it.
* If message is not hop-by-hop, decrements TTL of copy.
+ * @param payload_type Type of payload, in case the message is encrypted.
* @param c Connection on which this message is transmitted.
* @param fwd Is this a fwd message?
* @param force Force the connection to accept the message (buffer overfill).
@@ -2839,6 +2859,7 @@
*/
struct MeshConnectionQueue *
GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
+ uint16_t payload_type, uint32_t payload_id,
struct MeshConnection *c, int fwd, int force,
GMC_sent cont, void *cont_cls)
{
@@ -2854,8 +2875,8 @@
data = GNUNET_malloc (size);
memcpy (data, message, size);
type = ntohs (message->type);
- LOG (GNUNET_ERROR_TYPE_INFO, "-> %s on connection %s (%u bytes)\n",
- GM_m2s (type), GMC_2s (c), size);
+ LOG (GNUNET_ERROR_TYPE_INFO, "--> %s (%s %u) on connection %s (%u bytes)\n",
+ GM_m2s (type), GM_m2s (payload_type), payload_id, GMC_2s (c), size);
fc = fwd ? &c->fwd_fc : &c->bck_fc;
droppable = GNUNET_NO == force;
@@ -2961,13 +2982,13 @@
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P+ %p %u\n", c, c->pending_messages);
- c->pending_messages++;
+// c->pending_messages++;
q = GNUNET_new (struct MeshConnectionQueue);
q->forced = !droppable;
q->pid = pid;
- q->q = GMP_queue_add (get_hop (c, fwd), data, type, size, c, fwd,
- &message_sent, q);
+ q->q = GMP_queue_add (get_hop (c, fwd), data, type, payload_type, payload_id,
+ size, c, fwd, &message_sent, q);
if (NULL == q->q)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING dropping msg on %s\n", GMC_2s (c));
@@ -3025,6 +3046,7 @@
connection->maintenance_q =
GMP_queue_add (get_next_hop (connection), NULL,
GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE,
+ GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE, 0,
size, connection, GNUNET_YES, &message_sent, NULL);
state = GMT_get_cstate (connection->t);
@@ -3060,11 +3082,13 @@
GMC_2s (c));
if (GNUNET_NO == GMC_is_terminal (c, GNUNET_YES))
- GMC_send_prebuilt_message (&msg.header, c,
- GNUNET_YES, GNUNET_YES, NULL, NULL);
+ GMC_send_prebuilt_message (&msg.header,
+ GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY, 0,
+ c, GNUNET_YES, GNUNET_YES, NULL, NULL);
if (GNUNET_NO == GMC_is_terminal (c, GNUNET_NO))
- GMC_send_prebuilt_message (&msg.header, c,
- GNUNET_NO, GNUNET_YES, NULL, NULL);
+ GMC_send_prebuilt_message (&msg.header,
+ GNUNET_MESSAGE_TYPE_MESH_CONNECTION_DESTROY, 0,
+ c, GNUNET_NO, GNUNET_YES, NULL, NULL);
c->destroy = GNUNET_YES;
c->state = MESH_CONNECTION_DESTROYED;
}
Modified: gnunet/src/mesh/gnunet-service-mesh_connection.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.h 2014-04-11 15:30:39 UTC
(rev 33046)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.h 2014-04-11 17:01:26 UTC
(rev 33047)
@@ -472,6 +472,7 @@
*
* @param message Message to send. Function makes a copy of it.
* If message is not hop-by-hop, decrements TTL of copy.
+ * @param payload_type Type of payload, in case the message is encrypted.
* @param c Connection on which this message is transmitted.
* @param fwd Is this a fwd message?
* @param force Force the connection to accept the message (buffer overfill).
@@ -484,6 +485,7 @@
*/
struct MeshConnectionQueue *
GMC_send_prebuilt_message (const struct GNUNET_MessageHeader *message,
+ uint16_t payload_type, uint32_t payload_id,
struct MeshConnection *c, int fwd, int force,
GMC_sent cont, void *cont_cls);
Modified: gnunet/src/mesh/gnunet-service-mesh_peer.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.c 2014-04-11 15:30:39 UTC (rev
33046)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.c 2014-04-11 17:01:26 UTC (rev
33047)
@@ -75,12 +75,22 @@
*/
void *cls;
- /**
- * Type of message
- */
+ /**
+ * Type of message
+ */
uint16_t type;
- /**
+ /**
+ * Type of message
+ */
+ uint16_t payload_type;
+
+ /**
+ * Type of message
+ */
+ uint32_t payload_id;
+
+ /**
* Size of the message
*/
size_t size;
@@ -984,8 +994,9 @@
else
{
LOG (GNUNET_ERROR_TYPE_INFO,
- "ss %s on connection %s (%p) %s (size %u)\n",
- GM_m2s (queue->type), GMC_2s (c), c, GM_f2s (queue->fwd), data_size);
+ "snd %s (%s %u) on connection %s (%p) %s (size %u)\n",
+ GM_m2s (queue->type), GM_m2s (queue->payload_type),
+ queue->payload_type, GMC_2s (c), c, GM_f2s (queue->fwd), data_size);
}
/* Free queue, but cls was freed by send_core_* */
@@ -1116,7 +1127,8 @@
* message has been sent and therefore the handle is no longer valid.
*/
struct MeshPeerQueue *
-GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, size_t size,
+GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type,
+ uint16_t payload_type, uint32_t payload_id, size_t size,
struct MeshConnection *c, int fwd,
GMP_sent cont, void *cont_cls)
{
@@ -1124,8 +1136,10 @@
int priority;
int call_core;
- LOG (GNUNET_ERROR_TYPE_INFO, "qq %s on connection %s (%p) %s towards %s
(size %u)\n",
- GM_m2s (type), GMC_2s (c), c, GM_f2s (fwd), GMP_2s(peer), size);
+ LOG (GNUNET_ERROR_TYPE_INFO,
+ "que %s (%s %u) on connection %s (%p) %s towards %s (size %u)\n",
+ GM_m2s (type), GM_m2s (payload_type), payload_id,
+ GMC_2s (c), c, GM_f2s (fwd), GMP_2s (peer), size);
if (NULL == peer->connections)
{
@@ -1150,6 +1164,8 @@
queue = GNUNET_new (struct MeshPeerQueue);
queue->cls = cls;
queue->type = type;
+ queue->payload_type = payload_type;
+ queue->payload_id = payload_id;
queue->size = size;
queue->peer = peer;
queue->c = c;
Modified: gnunet/src/mesh/gnunet-service-mesh_peer.h
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_peer.h 2014-04-11 15:30:39 UTC (rev
33046)
+++ gnunet/src/mesh/gnunet-service-mesh_peer.h 2014-04-11 17:01:26 UTC (rev
33047)
@@ -148,8 +148,9 @@
* message has been sent and therefore the handle is no longer valid.
*/
struct MeshPeerQueue *
-GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type, size_t size,
- struct MeshConnection *c, int fwd,
+GMP_queue_add (struct MeshPeer *peer, void *cls, uint16_t type,
+ uint16_t payload_type, uint32_t payload_id,
+ size_t size, struct MeshConnection *c, int fwd,
GMP_sent cont, void *cont_cls);
/**
Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2014-04-11 15:30:39 UTC
(rev 33046)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c 2014-04-11 17:01:26 UTC
(rev 33047)
@@ -804,6 +804,7 @@
struct GNUNET_MESH_Encrypted *msg;
size_t size = ntohs (message->size);
char cbuf[sizeof (struct GNUNET_MESH_Encrypted) + size];
+ uint32_t mid;
uint32_t iv;
uint16_t type;
int fwd;
@@ -851,12 +852,18 @@
return NULL;
}
+ mid = 0;
type = ntohs (message->type);
switch (type)
{
- case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE:
case GNUNET_MESSAGE_TYPE_MESH_DATA:
case GNUNET_MESSAGE_TYPE_MESH_DATA_ACK:
+ if (GNUNET_MESSAGE_TYPE_MESH_DATA == type)
+ mid = ntohl (((struct GNUNET_MESH_Data *) message)->mid);
+ else
+ mid = ntohl (((struct GNUNET_MESH_DataACK *) message)->mid);
+ /* Fall thru */
+ case GNUNET_MESSAGE_TYPE_MESH_KEEPALIVE:
case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE:
case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY:
case GNUNET_MESSAGE_TYPE_MESH_CHANNEL_ACK:
@@ -865,8 +872,7 @@
msg->ttl = htonl (default_ttl);
break;
default:
- LOG (GNUNET_ERROR_TYPE_DEBUG, "unkown type %s\n",
- GM_m2s (type));
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "unkown type %s\n", GM_m2s (type));
GNUNET_break (0);
}
@@ -874,7 +880,9 @@
if (NULL == cont)
{
- (void) GMC_send_prebuilt_message (&msg->header, c, fwd, force, NULL, NULL);
+ GNUNET_break (NULL ==
+ GMC_send_prebuilt_message (&msg->header, type, mid,
+ c, fwd, force, NULL, NULL));
return NULL;
}
if (NULL == existing_q)
@@ -886,7 +894,7 @@
tq = existing_q;
tq->tqd = NULL;
}
- tq->cq = GMC_send_prebuilt_message (&msg->header, c, fwd, force,
+ tq->cq = GMC_send_prebuilt_message (&msg->header, type, mid, c, fwd, force,
&tun_message_sent, tq);
tq->cont = cont;
tq->cont_cls = cont_cls;
@@ -1012,7 +1020,8 @@
fwd = GMC_is_origin (t->connection_head->c, GNUNET_YES);
/* TODO save handle and cancel in case of a unneeded retransmission */
- GMC_send_prebuilt_message (&msg->header, c, fwd, GNUNET_YES, NULL, NULL);
+ GMC_send_prebuilt_message (&msg->header, GNUNET_MESSAGE_TYPE_MESH_KX,
+ message->type, c, fwd, GNUNET_YES, NULL, NULL);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33047 - gnunet/src/mesh,
gnunet <=