From: Bart Polot Date: Mon, 12 Aug 2013 12:47:21 +0000 (+0000) Subject: - use new mesh for test_mesh_local X-Git-Tag: initial-import-from-subversion-38251~7922 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9a2acd24918e45cec9c20e968089a2325a06fbf4;p=oweals%2Fgnunet.git - use new mesh for test_mesh_local --- diff --git a/src/mesh/Makefile.am b/src/mesh/Makefile.am index c3d478138..271d5e994 100644 --- a/src/mesh/Makefile.am +++ b/src/mesh/Makefile.am @@ -132,9 +132,9 @@ libgnunetmeshtest_a_SOURCES = \ libgnunetmeshtest_a_LIBADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testbed/libgnunettestbed.la \ - $(top_builddir)/src/mesh/libgnunetmesh.la + $(top_builddir)/src/mesh/libgnunetmeshenc.la libgnunetmeshtest_a_DEPENDENCIES = \ - libgnunetmesh.la + libgnunetmeshenc.la if HAVE_TESTING check_PROGRAMS = \ @@ -155,11 +155,11 @@ ld_mesh_test_lib = \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testing/libgnunettesting.la \ $(top_builddir)/src/mesh/libgnunetmeshtest.a \ - $(top_builddir)/src/mesh/libgnunetmesh.la \ + $(top_builddir)/src/mesh/libgnunetmeshenc.la \ $(top_builddir)/src/testbed/libgnunettestbed.la dep_mesh_test_lib = \ - libgnunetmesh.la \ + libgnunetmeshenc.la \ libgnunetmeshtest.a test_mesh_single_SOURCES = \ diff --git a/src/mesh/test_mesh.conf b/src/mesh/test_mesh.conf index ed3ad292f..01d7544e5 100644 --- a/src/mesh/test_mesh.conf +++ b/src/mesh/test_mesh.conf @@ -2,7 +2,7 @@ SERVICEHOME = /tmp/test-mesh/ [mesh] -#BINARY = gnunet-service-mesh +BINARY = gnunet-service-mesh-enc AUTOSTART = NO ACCEPT_FROM = 127.0.0.1; HOSTNAME = localhost diff --git a/src/mesh/test_mesh_local.c b/src/mesh/test_mesh_local.c index fd1a7a242..25ccf7b2e 100644 --- a/src/mesh/test_mesh_local.c +++ b/src/mesh/test_mesh_local.c @@ -28,7 +28,7 @@ #include "gnunet_util_lib.h" #include "gnunet_dht_service.h" #include "gnunet_testing_lib.h" -#include "gnunet_mesh_service.h" +#include "gnunet_mesh_service_enc.h" struct GNUNET_TESTING_Peer *me; @@ -36,7 +36,7 @@ static struct GNUNET_MESH_Handle *mesh_peer_1; static struct GNUNET_MESH_Handle *mesh_peer_2; -static struct GNUNET_MESH_Tunnel *t; +static struct GNUNET_MESH_Channel *ch; static int result = GNUNET_OK; @@ -56,9 +56,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { GNUNET_SCHEDULER_cancel (abort_task); } - if (NULL != t) + if (NULL != ch) { - GNUNET_MESH_tunnel_destroy (t); + GNUNET_MESH_channel_destroy (ch); } GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect client 1\n"); if (NULL != mesh_peer_1) @@ -95,15 +95,16 @@ do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Function is called whenever a message is received. * * @param cls closure (set from GNUNET_MESH_connect) - * @param tunnel connection to the other end - * @param tunnel_ctx place to store local state associated with the tunnel + * @param channel connection to the other end + * @param channel_ctx place to store local state associated with the channel * @param message the actual message * * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ static int -data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx, +data_callback (void *cls, struct GNUNET_MESH_Channel *channel, + void **channel_ctx, const struct GNUNET_MessageHeader *message) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data callback! Shutting down.\n"); @@ -112,23 +113,24 @@ data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx, shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_shutdown, NULL); - GNUNET_MESH_receive_done (tunnel); + GNUNET_MESH_receive_done (channel); return GNUNET_OK; } /** - * Method called whenever another peer has added us to a tunnel + * Method called whenever another peer has added us to a channel * the other peer initiated. * * @param cls closure - * @param tunnel new handle to the tunnel - * @param initiator peer that started the tunnel + * @param channel new handle to the channel + * @param initiator peer that started the channel * @param port port number - * @return initial tunnel context for the tunnel (can be NULL -- that's not an error) + * @return initial channel context for the channel + * (can be NULL -- that's not an error) */ static void * -inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel, +inbound_tunnel (void *cls, struct GNUNET_MESH_Channel *channel, const struct GNUNET_PeerIdentity *initiator, uint32_t port) { @@ -148,22 +150,22 @@ inbound_tunnel (void *cls, struct GNUNET_MESH_Tunnel *tunnel, /** - * Function called whenever an inbound tunnel is destroyed. Should clean up + * Function called whenever an inbound channel is destroyed. Should clean up * any associated state. * * @param cls closure (set from GNUNET_MESH_connect) - * @param tunnel connection to the other end (henceforth invalid) - * @param tunnel_ctx place where local state associated - * with the tunnel is stored + * @param channel connection to the other end (henceforth invalid) + * @param channel_ctx place where local state associated + * with the channel is stored */ static void -inbound_end (void *cls, const struct GNUNET_MESH_Tunnel *tunnel, - void *tunnel_ctx) +inbound_end (void *cls, const struct GNUNET_MESH_Channel *channel, + void *channel_ctx) { long id = (long) cls; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "incoming tunnel closed at peer %ld\n", + "incoming channel closed at peer %ld\n", id); } @@ -225,8 +227,9 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_TESTING_peer_get_identity (me, &id); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n"); - t = GNUNET_MESH_tunnel_create (mesh_peer_1, NULL, &id, 1, GNUNET_YES, GNUNET_NO); - GNUNET_MESH_notify_transmit_ready (t, GNUNET_NO, + ch = GNUNET_MESH_channel_create (mesh_peer_1, NULL, &id, 1, + GNUNET_YES, GNUNET_NO); + GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_REL, sizeof (struct GNUNET_MessageHeader), &do_send, NULL);