{
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]);
}
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)
/* 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);
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)
{
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;
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;
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)
{
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;
}
};
-// 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;
/**
#if VERBOSE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Shutdown of peers failed!\n");
#endif
- ok++;
+ ok--;
}
else
{
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;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"test: peer %s disconnected\n",
GNUNET_i2s(peer));
+ if (memcmp(&d2->id, peer, sizeof(d2->id)))
+ ok++;
return;
}
"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;
}
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",
#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 */