[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17394 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17394 - gnunet/src/mesh |
Date: |
Wed, 12 Oct 2011 09:10:07 +0200 |
Author: bartpolot
Date: 2011-10-12 09:10:07 +0200 (Wed, 12 Oct 2011)
New Revision: 17394
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
gnunet/src/mesh/test_mesh_small_unicast.c
Log:
Fixed bugs, added debug messages, extended unicast testcase
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2011-10-11 17:22:27 UTC (rev
17393)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2011-10-12 07:10:07 UTC (rev
17394)
@@ -1427,6 +1427,8 @@
{
GNUNET_assert (0 != own_pos);
tree_add_path(t->tree, p, NULL);
+ if (NULL == t->tree->me)
+ t->tree->me = tree_find_peer(t->tree->root, p->peers[own_pos]);
}
@@ -2243,10 +2245,14 @@
const struct GNUNET_TRANSPORT_ATS_Information *atsi)
{
struct GNUNET_MESH_PathACK *msg;
+ struct GNUNET_PeerIdentity id;
struct MeshTunnelTreeNode *n;
struct MeshPeerInfo *peer_info;
struct MeshTunnel *t;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: Received a path ACK msg [%s]\n",
+ GNUNET_i2s(&my_full_id));
msg = (struct GNUNET_MESH_PathACK *) message;
t = tunnel_get (&msg->oid, msg->tid);
if (NULL == t)
@@ -2258,6 +2264,8 @@
/* Message for us? */
if (0 == memcmp (&msg->oid, &my_full_id, sizeof (struct
GNUNET_PeerIdentity)))
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: It's for us!\n");
if (NULL == t->client)
{
GNUNET_break_op (0);
@@ -2279,7 +2287,10 @@
send_client_peer_connected(t, peer_info->id);
return GNUNET_OK;
}
-
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MESH: not for us, retransmitting...\n");
+ GNUNET_PEER_resolve(t->tree->me->parent->peer, &id);
peer_info = peer_info_get (&msg->oid);
if (NULL == peer_info)
{
@@ -2291,8 +2302,7 @@
memcpy (msg, message, sizeof (struct GNUNET_MESH_PathACK));
GNUNET_CORE_notify_transmit_ready (core_handle, 0, 0,
GNUNET_TIME_UNIT_FOREVER_REL,
- path_get_first_hop (t->tree,
- peer_info->id),
+ &id,
sizeof (struct GNUNET_MESH_PathACK),
&send_core_data_raw, msg);
return GNUNET_OK;
@@ -3303,20 +3313,26 @@
struct MeshPeerInfo *peer_info;
struct MeshPeerPath *path;
+#if MESH_DEBUG_CONNECTION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Peer connected\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: %s\n",
GNUNET_h2s(&my_full_id.hashPubKey));
+#endif
peer_info = peer_info_get (peer);
if (myid == peer_info->id)
{
+#if MESH_DEBUG_CONNECTION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: (self)\n");
+#endif
return;
}
+#if MESH_DEBUG_CONNECTION
else
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: %s\n",
GNUNET_h2s(&peer->hashPubKey));
}
+#endif
path = path_new (2);
path->peers[0] = myid;
path->peers[1] = peer_info->id;
@@ -3338,7 +3354,9 @@
struct MeshPeerInfo *pi;
unsigned int i;
+#if MESH_DEBUG_CONNECTION
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: Peer disconnected\n");
+#endif
pi = GNUNET_CONTAINER_multihashmap_get (peers, &peer->hashPubKey);
if (NULL == pi)
{
@@ -3350,10 +3368,12 @@
peer_info_cancel_transmission(pi, i);
}
path_remove_from_peer (pi, pi->id, myid);
+#if MESH_DEBUG_CONNECTION
if (myid == pi->id)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: (self)\n");
}
+#endif
return;
}
Modified: gnunet/src/mesh/test_mesh_small_unicast.c
===================================================================
--- gnunet/src/mesh/test_mesh_small_unicast.c 2011-10-11 17:22:27 UTC (rev
17393)
+++ gnunet/src/mesh/test_mesh_small_unicast.c 2011-10-12 07:10:07 UTC (rev
17394)
@@ -47,15 +47,18 @@
};
-// static struct MeshPeer *peer_head;
-//
-// static struct MeshPeer *peer_tail;
-
/**
* How long until we give up on connecting the peers?
*/
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1500)
+/**
+ * Time to wait for stuff that should be rather fast
+ */
+#define SHORT_TIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
+
+#define OK_GOAL 2
+
static int ok;
/**
@@ -147,7 +150,7 @@
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Shutdown of peers failed!\n");
#endif
- ok++;
+ ok--;
}
else
{
@@ -220,9 +223,11 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: Incoming tunnel from %s\n",
GNUNET_i2s(initiator));
+ ok++;
GNUNET_SCHEDULER_cancel (disconnect_task);
- disconnect_task = GNUNET_SCHEDULER_add_now(&disconnect_mesh_peers, NULL);
- ok = 0;
+ disconnect_task = GNUNET_SCHEDULER_add_delayed(SHORT_TIME,
+ &disconnect_mesh_peers,
+ NULL);
return NULL;
}
@@ -258,6 +263,8 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: peer %s disconnected\n",
GNUNET_i2s(peer));
+ if (memcmp(&d2->id, peer, sizeof(d2->id)))
+ ok++;
return;
}
@@ -428,7 +435,7 @@
"test: Peergroup callback called with error, aborting
test!\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: Error from testing: `%s'\n", emsg);
- ok++;
+ ok--;
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
return;
}
@@ -529,7 +536,7 @@
unsigned long long temp_wait;
struct GNUNET_TESTING_Host *hosts;
- ok = 1;
+ ok = 0;
testing_cfg = GNUNET_CONFIGURATION_dup (cfg);
GNUNET_log_setup ("test_mesh_small_unicast",
@@ -662,11 +669,12 @@
#if REMOVE_DIR
GNUNET_DISK_directory_remove ("/tmp/test_mesh_small_unicast");
#endif
- if (0 != ok)
+ if (OK_GOAL != ok)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "test: FAILED!\n");
+ return 1;
}
- return ok;
+ return 0;
}
/* end of test_mesh_small_unicast.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17394 - gnunet/src/mesh,
gnunet <=