summaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-tng.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-11-14 14:42:12 +0100
committerChristian Grothoff <christian@grothoff.org>2018-11-14 14:42:12 +0100
commitda9d61bdbddb37424a465f63f6b4c691b342363e (patch)
treedc63e848a45e02af8898b8b048b336cd3604624d /src/transport/gnunet-service-tng.c
parent2f3c9c69f7b6cea83930e8c927d35b519a5655a0 (diff)
add logic to handle monitor start to gnunet-service-tng.c
Diffstat (limited to 'src/transport/gnunet-service-tng.c')
-rw-r--r--src/transport/gnunet-service-tng.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index 447e9fa5d..d92964654 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -145,7 +145,7 @@ struct GNUNET_STATISTICS_Handle *GST_stats;
const struct GNUNET_CONFIGURATION_Handle *GST_cfg;
/**
- * Configuration handle.
+ * Our public key.
*/
struct GNUNET_PeerIdentity GST_my_identity;
@@ -588,6 +588,31 @@ handle_send_message_ack (void *cls,
/**
+ * Initialize a monitor client.
+ *
+ * @param cls the client
+ * @param start the start message that was sent
+ */
+static void
+handle_monitor_start (void *cls,
+ const struct GNUNET_TRANSPORT_MonitorStart *start)
+{
+ struct TransportClient *tc = cls;
+
+ if (CT_NONE != tc->type)
+ {
+ GNUNET_break (0);
+ GNUNET_SERVICE_client_drop (tc->client);
+ return;
+ }
+ tc->type = CT_MONITOR;
+ tc->details.monitor_peer = start->peer;
+ // FIXME: remember also the one_shot flag!
+ GNUNET_SERVICE_client_continue (tc->client);
+}
+
+
+/**
* Function called when the service shuts down. Unloads our plugins
* and cancels pending validations.
*
@@ -708,6 +733,11 @@ GNUNET_SERVICE_MAIN
GNUNET_MESSAGE_TYPE_TRANSPORT_SEND_MSG_ACK,
struct GNUNET_TRANSPORT_SendMessageToAck,
NULL),
+ /* communication with monitors */
+ GNUNET_MQ_hd_fixed_size (monitor_start,
+ GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_START,
+ struct GNUNET_TRANSPORT_MonitorStart,
+ NULL),
GNUNET_MQ_handler_end ());