aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_clients.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-11-07 16:33:42 +0000
committerChristian Grothoff <christian@grothoff.org>2014-11-07 16:33:42 +0000
commit0c89b2a16eae49cb23635f6d6c0f13da070c5c66 (patch)
tree559186ca56ac1279a611d31f3bf3816bc971431c /src/transport/gnunet-service-transport_clients.c
parent2e33b6fcbad3c1b8ebf7176c39a201c39b23c2b2 (diff)
downloadgnunet-0c89b2a16eae49cb23635f6d6c0f13da070c5c66.tar.gz
gnunet-0c89b2a16eae49cb23635f6d6c0f13da070c5c66.zip
implementing plugin session monitoring API (#3452)
Diffstat (limited to 'src/transport/gnunet-service-transport_clients.c')
-rw-r--r--src/transport/gnunet-service-transport_clients.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index b67d432c5..df73affc2 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -117,6 +117,7 @@ struct TransportClient
117 int send_payload; 117 int send_payload;
118}; 118};
119 119
120
120/** 121/**
121 * Context for address to string operations 122 * Context for address to string operations
122 */ 123 */
@@ -138,6 +139,7 @@ struct AddressToStringContext
138 struct GNUNET_SERVER_TransmitContext* tc; 139 struct GNUNET_SERVER_TransmitContext* tc;
139}; 140};
140 141
142
141/** 143/**
142 * Client monitoring changes of active addresses of our neighbours. 144 * Client monitoring changes of active addresses of our neighbours.
143 */ 145 */
@@ -225,6 +227,7 @@ static struct GNUNET_SERVER_NotificationContext *val_nc;
225 */ 227 */
226static struct GNUNET_SERVER_NotificationContext *plugin_nc; 228static struct GNUNET_SERVER_NotificationContext *plugin_nc;
227 229
230
228/** 231/**
229 * Find the internal handle associated with the given client handle 232 * Find the internal handle associated with the given client handle
230 * 233 *
@@ -306,6 +309,7 @@ setup_peer_monitoring_client (struct GNUNET_SERVER_Client *client,
306 mc->client = client; 309 mc->client = client;
307 mc->peer = *peer; 310 mc->peer = *peer;
308 GNUNET_CONTAINER_DLL_insert (peer_monitoring_clients_head, peer_monitoring_clients_tail, mc); 311 GNUNET_CONTAINER_DLL_insert (peer_monitoring_clients_head, peer_monitoring_clients_tail, mc);
312 GNUNET_SERVER_client_mark_monitor (client);
309 GNUNET_SERVER_notification_context_add (peer_nc, client); 313 GNUNET_SERVER_notification_context_add (peer_nc, client);
310 314
311 if (0 != memcmp (peer, &all_zeros, sizeof (struct GNUNET_PeerIdentity))) 315 if (0 != memcmp (peer, &all_zeros, sizeof (struct GNUNET_PeerIdentity)))
@@ -635,7 +639,7 @@ clients_handle_hello (void *cls, struct GNUNET_SERVER_Client *client,
635 639
636 640
637/** 641/**
638 * Closure for 'handle_send_transmit_continuation' 642 * Closure for #handle_send_transmit_continuation()
639 */ 643 */
640struct SendTransmitContinuationContext 644struct SendTransmitContinuationContext
641{ 645{
@@ -1068,6 +1072,7 @@ compose_address_iterate_response_message (const struct GNUNET_PeerIdentity *peer
1068 return msg; 1072 return msg;
1069} 1073}
1070 1074
1075
1071/** 1076/**
1072 * Compose #PeerIterateResponseMessage using the given peer and address. 1077 * Compose #PeerIterateResponseMessage using the given peer and address.
1073 * 1078 *
@@ -1077,7 +1082,7 @@ compose_address_iterate_response_message (const struct GNUNET_PeerIdentity *peer
1077 */ 1082 */
1078static struct ValidationIterateResponseMessage * 1083static struct ValidationIterateResponseMessage *
1079compose_validation_iterate_response_message (const struct GNUNET_PeerIdentity *peer, 1084compose_validation_iterate_response_message (const struct GNUNET_PeerIdentity *peer,
1080 const struct GNUNET_HELLO_Address *address) 1085 const struct GNUNET_HELLO_Address *address)
1081{ 1086{
1082 struct ValidationIterateResponseMessage *msg; 1087 struct ValidationIterateResponseMessage *msg;
1083 size_t size; 1088 size_t size;
@@ -1113,12 +1118,26 @@ compose_validation_iterate_response_message (const struct GNUNET_PeerIdentity *p
1113 return msg; 1118 return msg;
1114} 1119}
1115 1120
1121
1122/**
1123 * Context for #send_validation_information() and
1124 * #send_peer_information().
1125 */
1116struct IterationContext 1126struct IterationContext
1117{ 1127{
1128 /**
1129 * Context to use for the transmission.
1130 */
1118 struct GNUNET_SERVER_TransmitContext *tc; 1131 struct GNUNET_SERVER_TransmitContext *tc;
1119 1132
1133 /**
1134 * Which peers do we care about?
1135 */
1120 struct GNUNET_PeerIdentity id; 1136 struct GNUNET_PeerIdentity id;
1121 1137
1138 /**
1139 * #GNUNET_YES if @e id should be ignored because we want all peers.
1140 */
1122 int all; 1141 int all;
1123}; 1142};
1124 1143
@@ -1245,6 +1264,7 @@ clients_handle_monitor_peers (void *cls, struct GNUNET_SERVER_Client *client,
1245 return; 1264 return;
1246 } 1265 }
1247 GNUNET_SERVER_disable_receive_done_warning (client); 1266 GNUNET_SERVER_disable_receive_done_warning (client);
1267 GNUNET_SERVER_client_mark_monitor (client);
1248 pc.tc = tc = GNUNET_SERVER_transmit_context_create (client); 1268 pc.tc = tc = GNUNET_SERVER_transmit_context_create (client);
1249 1269
1250 /* Send initial list */ 1270 /* Send initial list */
@@ -1318,6 +1338,7 @@ clients_handle_monitor_validation (void *cls,
1318 return; 1338 return;
1319 } 1339 }
1320 GNUNET_SERVER_disable_receive_done_warning (client); 1340 GNUNET_SERVER_disable_receive_done_warning (client);
1341 GNUNET_SERVER_client_mark_monitor (client);
1321 pc.tc = tc = GNUNET_SERVER_transmit_context_create (client); 1342 pc.tc = tc = GNUNET_SERVER_transmit_context_create (client);
1322 1343
1323 /* Send initial list */ 1344 /* Send initial list */
@@ -1396,6 +1417,7 @@ plugin_session_info_cb (void *cls,
1396 msg->timeout = GNUNET_TIME_absolute_hton (info->session_timeout); 1417 msg->timeout = GNUNET_TIME_absolute_hton (info->session_timeout);
1397 msg->delay = GNUNET_TIME_absolute_hton (info->receive_delay); 1418 msg->delay = GNUNET_TIME_absolute_hton (info->receive_delay);
1398 msg->peer = info->address->peer; 1419 msg->peer = info->address->peer;
1420 msg->session_id = (uint64_t) (intptr_t) session;
1399 msg->plugin_name_len = htons (slen); 1421 msg->plugin_name_len = htons (slen);
1400 msg->plugin_address_len = htons (alen); 1422 msg->plugin_address_len = htons (alen);
1401 name = (char *) &msg[1]; 1423 name = (char *) &msg[1];
@@ -1421,6 +1443,7 @@ clients_handle_monitor_plugins (void *cls,
1421 struct GNUNET_SERVER_Client *client, 1443 struct GNUNET_SERVER_Client *client,
1422 const struct GNUNET_MessageHeader *message) 1444 const struct GNUNET_MessageHeader *message)
1423{ 1445{
1446 GNUNET_SERVER_client_mark_monitor (client);
1424 GNUNET_SERVER_disable_receive_done_warning (client); 1447 GNUNET_SERVER_disable_receive_done_warning (client);
1425 if (0 == GNUNET_SERVER_notification_context_get_size (plugin_nc)) 1448 if (0 == GNUNET_SERVER_notification_context_get_size (plugin_nc))
1426 GST_plugins_monitor_subscribe (&plugin_session_info_cb, NULL); 1449 GST_plugins_monitor_subscribe (&plugin_session_info_cb, NULL);