gnunet_service_mesh_CFLAGS = $(AM_CFLAGS)
gnunet_service_mesh_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/transport>/libgnunettransport.la \
$(top_builddir)/src/core/libgnunetcore.la \
$(top_builddir)/src/dht/libgnunetdht.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/block/libgnunetblock.la
gnunet_service_mesh_DEPENDENCIES = \
$(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/transport/libgnunettransport.la \
$(top_builddir)/src/core/libgnunetcore.la \
$(top_builddir)/src/dht/libgnunetdht.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
#include "platform.h"
#include "gnunet_util_lib.h"
+#include "gnunet_transport_service.h"
#include "gnunet_core_service.h"
#include "gnunet_statistics_service.h"
/**
* Hello message.
*/
- const struct GNUNET_HELLO_Message* hello;
+ struct GNUNET_HELLO_Message* hello;
};
*/
static struct GNUNET_CORE_Handle *core_handle;
+static struct GNUNET_TRANSPORT_Handle *transport_handle;
+
/******************************************************************************/
/***************************** CORE CALLBACKS *********************************/
NULL, /* Don't notify about all outbound messages */
GNUNET_NO, /* For header-only out notification */
core_handlers); /* Register these handlers */
- if (NULL == core_handle)
+ transport_handle = GNUNET_TRANSPORT_connect (c, &my_full_id,
+ NULL, /* cls */
+ NULL, NULL, NULL); /* Notify callbacks */
+
+ if (NULL == core_handle || NULL == transport_handle)
{
GNUNET_break (0);
GNUNET_SCHEDULER_shutdown ();
return;
}
+
}
/**
}
+/**
+ * Try to connect to a peer on transport level.
+ *
+ * @param cls Closure (peer).
+ * @param tc TaskContext.
+ */
+static void
+try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct MeshPeer *peer = cls;
+
+ if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
+ return;
+
+ GNUNET_TRANSPORT_try_connect (transport_handle,
+ GNUNET_PEER_resolve2 (peer->id), NULL, NULL);
+}
+
/**
* Try to establish a new connection to this peer (in its tunnel).
* If the peer doesn't have any path to it yet, try to get one.
struct MeshTunnel3 *t;
struct MeshPeerPath *p;
struct MeshConnection *c;
+ struct GNUNET_HELLO_Message *hello;
int rerun_search;
LOG (GNUNET_ERROR_TYPE_DEBUG, "peer_connect towards %s\n", GMP_2s (peer));
+
+ /* If we have a current hello, try to connect using it. */
+ hello = GMP_get_hello (peer);
+ if (NULL != hello)
+ {
+ struct GNUNET_MessageHeader *mh;
+
+ mh = GNUNET_HELLO_get_header (hello);
+ GNUNET_TRANSPORT_offer_hello (transport_handle, mh, try_connect, peer);
+ }
+
t = peer->tunnel;
c = NULL;
rerun_search = GNUNET_NO;
* @param hello Hello message.
*/
void
-GMP_set_hello (struct MeshPeer *peer, const struct GNUNET_HELLO_Message *hello)
+GMP_set_hello (struct MeshPeer *peer, struct GNUNET_HELLO_Message *hello)
{
struct GNUNET_TIME_Absolute expiration;
struct GNUNET_TIME_Relative remaining;
*
* @return Hello message.
*/
-const struct GNUNET_HELLO_Message *
+struct GNUNET_HELLO_Message *
GMP_get_hello (struct MeshPeer *peer)
{
struct GNUNET_TIME_Absolute expiration;