[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28201 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28201 - gnunet/src/mesh |
Date: |
Fri, 19 Jul 2013 16:27:51 +0200 |
Author: bartpolot
Date: 2013-07-19 16:27:50 +0200 (Fri, 19 Jul 2013)
New Revision: 28201
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
Log:
- log tunnel state evolution
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2013-07-19 13:55:58 UTC (rev
28200)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2013-07-19 14:27:50 UTC (rev
28201)
@@ -837,6 +837,16 @@
/**
+ * Change the tunnel state.
+ *
+ * @param t Tunnel whose ttate to change.
+ * @param state New state.
+ */
+static void
+tunnel_change_state (struct MeshTunnel *t, enum MeshTunnelState state);
+
+
+/**
* Notify a tunnel that a connection has broken that affects at least
* some of its peers.
*
@@ -959,6 +969,45 @@
__mesh_divider______________________________________________________________();
+static const char *
+GNUNET_MESH_DEBUG_S2S (enum MeshTunnelState s)
+{
+ static char buf[128];
+
+ switch (s)
+ {
+ /**
+ * Uninitialized status, should never appear in operation.
+ */
+ case MESH_TUNNEL_NEW: return "MESH_TUNNEL_NEW";
+
+ /**
+ * Path to the peer not known yet
+ */
+ case MESH_TUNNEL_SEARCHING: return "MESH_TUNNEL_SEARCHING";
+
+ /**
+ * Request sent, not yet answered.
+ */
+ case MESH_TUNNEL_WAITING: return "MESH_TUNNEL_WAITING";
+
+ /**
+ * Peer connected and ready to accept data
+ */
+ case MESH_TUNNEL_READY: return "MESH_TUNNEL_READY";
+
+ /**
+ * Peer connected previosly but not responding
+ */
+ case MESH_TUNNEL_RECONNECTING: return "MESH_TUNNEL_RECONNECTING";
+
+ default:
+ sprintf (buf, "%u (UNKNOWN STATE)", s);
+ return buf;
+ }
+}
+
+
/******************************************************************************/
/************************ PERIODIC FUNCTIONS
****************************/
/******************************************************************************/
@@ -1236,7 +1285,7 @@
(t->path->length * sizeof (struct GNUNET_PeerIdentity)),
neighbor,
t);
- t->state = MESH_TUNNEL_WAITING;
+ tunnel_change_state (t, MESH_TUNNEL_WAITING);
}
@@ -1248,16 +1297,16 @@
static void
send_path_ack (struct MeshTunnel *t)
{
- struct MeshPeerInfo *peer;
+ struct MeshPeerInfo *neighbor;
- peer = peer_get_short (t->prev_hop);
- t->state = MESH_TUNNEL_WAITING;
-
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send path ack\n");
+ neighbor = peer_get_short (t->prev_hop);
queue_add (t,
GNUNET_MESSAGE_TYPE_MESH_PATH_ACK,
sizeof (struct GNUNET_MESH_PathACK),
- peer,
+ neighbor,
t);
+ tunnel_change_state (t, MESH_TUNNEL_WAITING);
}
@@ -1574,7 +1623,7 @@
NULL, /* xquery */
0, /* xquery bits */
&dht_get_id_handler, peer);
- t->state = MESH_TUNNEL_SEARCHING;
+ tunnel_change_state (t, MESH_TUNNEL_SEARCHING);
}
else
{
@@ -2162,6 +2211,28 @@
/**
+ * Change the tunnel state.
+ *
+ * @param t Tunnel whose ttate to change.
+ * @param state New state.
+ */
+static void
+tunnel_change_state (struct MeshTunnel *t, enum MeshTunnelState state)
+{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Tunnel %s[%X] state was %s\n",
+ GNUNET_i2s (GNUNET_PEER_resolve2 (t->id.oid)), t->id.tid,
+ GNUNET_MESH_DEBUG_S2S (t->state));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Tunnel %s[%X] state is now %s\n",
+ GNUNET_i2s (GNUNET_PEER_resolve2 (t->id.oid)), t->id.tid,
+ GNUNET_MESH_DEBUG_S2S (state));
+ t->state = state;
+}
+
+
+
+/**
* Add a client to a tunnel, initializing all needed data structures.
*
* @param t Tunnel to which add the client.
@@ -3810,7 +3881,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " nobuffer:%d\n", t->nobuffer);
}
tunnel_reset_timeout (t, GNUNET_YES);
- t->state = MESH_TUNNEL_WAITING;
+ tunnel_change_state (t, MESH_TUNNEL_WAITING);
dest_peer_info =
GNUNET_CONTAINER_multihashmap_get (peers, &pi[size - 1].hashPubKey);
if (NULL == dest_peer_info)
@@ -3964,7 +4035,7 @@
{
GNUNET_break (0);
}
- t->state = MESH_TUNNEL_READY;
+ tunnel_change_state (t, MESH_TUNNEL_READY);
tunnel_reset_timeout (t, GNUNET_NO);
t->next_fc.last_ack_recv = (NULL == t->client) ? ntohl (msg->ack) : 0;
t->prev_fc.last_ack_sent = ntohl (msg->ack);
@@ -4170,7 +4241,7 @@
return GNUNET_OK;
}
if (NULL != c)
- t->state = MESH_TUNNEL_READY;
+ tunnel_change_state (t, MESH_TUNNEL_READY);
tunnel_reset_timeout (t, fwd);
if (NULL != c)
{
@@ -4472,7 +4543,7 @@
fc->last_ack_recv = ack;
peer_unlock_queue (id);
- t->state = MESH_TUNNEL_READY;
+ tunnel_change_state (t, MESH_TUNNEL_READY);
tunnel_send_ack (t, GNUNET_MESSAGE_TYPE_MESH_ACK, t->next_hop == id);
@@ -4589,7 +4660,7 @@
hop = fwd ? t->next_hop : t->prev_hop;
if (NULL != c)
- t->state = MESH_TUNNEL_READY;
+ tunnel_change_state (t, MESH_TUNNEL_READY);
tunnel_reset_timeout (t, fwd);
if (NULL != c || 0 == hop || myid == hop)
return GNUNET_OK;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28201 - gnunet/src/mesh,
gnunet <=