aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport_clients.c15
-rw-r--r--src/transport/gnunet-service-transport_plugins.c3
-rw-r--r--src/transport/gnunet-transport.c3
-rw-r--r--src/transport/plugin_transport_tcp.c34
-rw-r--r--src/transport/transport_api_monitor_peers.c2
-rw-r--r--src/transport/transport_api_monitor_plugins.c9
6 files changed, 43 insertions, 23 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 96b3e0bf3..d0aba723d 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -1235,7 +1235,6 @@ send_peer_information (void *cls,
1235} 1235}
1236 1236
1237 1237
1238
1239/** 1238/**
1240 * Client asked to obtain information about a specific or all peers 1239 * Client asked to obtain information about a specific or all peers
1241 * Process the request. 1240 * Process the request.
@@ -1399,6 +1398,7 @@ plugin_session_info_cb (void *cls,
1399 1398
1400 if (0 == GNUNET_SERVER_notification_context_get_size (plugin_nc)) 1399 if (0 == GNUNET_SERVER_notification_context_get_size (plugin_nc))
1401 { 1400 {
1401 fprintf (stderr, "UNSUB!\n");
1402 GST_plugins_monitor_subscribe (NULL, NULL); 1402 GST_plugins_monitor_subscribe (NULL, NULL);
1403 return; 1403 return;
1404 } 1404 }
@@ -1463,9 +1463,9 @@ clients_handle_monitor_plugins (void *cls,
1463{ 1463{
1464 GNUNET_SERVER_client_mark_monitor (client); 1464 GNUNET_SERVER_client_mark_monitor (client);
1465 GNUNET_SERVER_disable_receive_done_warning (client); 1465 GNUNET_SERVER_disable_receive_done_warning (client);
1466 if (0 == GNUNET_SERVER_notification_context_get_size (plugin_nc))
1467 GST_plugins_monitor_subscribe (&plugin_session_info_cb, NULL);
1468 GNUNET_SERVER_notification_context_add (plugin_nc, client); 1466 GNUNET_SERVER_notification_context_add (plugin_nc, client);
1467 if (1 == GNUNET_SERVER_notification_context_get_size (plugin_nc))
1468 GST_plugins_monitor_subscribe (&plugin_session_info_cb, NULL);
1469} 1469}
1470 1470
1471 1471
@@ -1557,7 +1557,8 @@ GST_clients_stop ()
1557 * @param may_drop #GNUNET_YES if the message can be dropped / is payload 1557 * @param may_drop #GNUNET_YES if the message can be dropped / is payload
1558 */ 1558 */
1559void 1559void
1560GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, int may_drop) 1560GST_clients_broadcast (const struct GNUNET_MessageHeader *msg,
1561 int may_drop)
1561{ 1562{
1562 struct TransportClient *tc; 1563 struct TransportClient *tc;
1563 1564
@@ -1579,7 +1580,8 @@ GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, int may_drop)
1579 */ 1580 */
1580void 1581void
1581GST_clients_unicast (struct GNUNET_SERVER_Client *client, 1582GST_clients_unicast (struct GNUNET_SERVER_Client *client,
1582 const struct GNUNET_MessageHeader *msg, int may_drop) 1583 const struct GNUNET_MessageHeader *msg,
1584 int may_drop)
1583{ 1585{
1584 struct TransportClient *tc; 1586 struct TransportClient *tc;
1585 1587
@@ -1604,9 +1606,10 @@ GST_clients_broadcast_peer_notification (const struct GNUNET_PeerIdentity *peer,
1604 enum GNUNET_TRANSPORT_PeerState state, 1606 enum GNUNET_TRANSPORT_PeerState state,
1605 struct GNUNET_TIME_Absolute state_timeout) 1607 struct GNUNET_TIME_Absolute state_timeout)
1606{ 1608{
1609 static struct GNUNET_PeerIdentity all_zeros;
1607 struct PeerIterateResponseMessage *msg; 1610 struct PeerIterateResponseMessage *msg;
1608 struct MonitoringClient *mc; 1611 struct MonitoringClient *mc;
1609 static struct GNUNET_PeerIdentity all_zeros; 1612
1610 msg = compose_address_iterate_response_message (peer, address); 1613 msg = compose_address_iterate_response_message (peer, address);
1611 msg->state = htonl (state); 1614 msg->state = htonl (state);
1612 msg->state_timeout = GNUNET_TIME_absolute_hton (state_timeout); 1615 msg->state_timeout = GNUNET_TIME_absolute_hton (state_timeout);
diff --git a/src/transport/gnunet-service-transport_plugins.c b/src/transport/gnunet-service-transport_plugins.c
index e43b7057a..c029fcbc6 100644
--- a/src/transport/gnunet-service-transport_plugins.c
+++ b/src/transport/gnunet-service-transport_plugins.c
@@ -1,7 +1,7 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2010-2014 Christian Grothoff (and other contributing authors) 3 (C) 2010-2014 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation; either version 3, or (at your
@@ -78,7 +78,6 @@ static struct TransportPlugin *plugins_head;
78static struct TransportPlugin *plugins_tail; 78static struct TransportPlugin *plugins_tail;
79 79
80 80
81
82/** 81/**
83 * Load and initialize all plugins. The respective functions will be 82 * Load and initialize all plugins. The respective functions will be
84 * invoked by the plugins when the respective events happen. The 83 * invoked by the plugins when the respective events happen. The
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c
index 24be066bc..4b1e683f6 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -1599,9 +1599,12 @@ plugin_monitoring_cb (void *cls,
1599 const char *state; 1599 const char *state;
1600 struct PluginMonitorAddress *addr; 1600 struct PluginMonitorAddress *addr;
1601 1601
1602 fprintf (stderr, "E!\n");
1602 if ( (NULL == info) && 1603 if ( (NULL == info) &&
1603 (NULL == session) ) 1604 (NULL == session) )
1604 return; /* in sync with transport service */ 1605 return; /* in sync with transport service */
1606 if (NULL == info)
1607 return; /* shutdown */
1605 if ( (NULL != cpid) && 1608 if ( (NULL != cpid) &&
1606 (0 != memcmp (&info->address->peer, 1609 (0 != memcmp (&info->address->peer,
1607 cpid, 1610 cpid,
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index ba8b5895e..664dcbb7d 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -475,7 +475,9 @@ notify_session_monitor (struct Plugin *plugin,
475 return; 475 return;
476 memset (&info, 0, sizeof (info)); 476 memset (&info, 0, sizeof (info));
477 info.state = state; 477 info.state = state;
478 info.is_inbound = GNUNET_SYSERR; /* hard to say */ 478 info.is_inbound = (0 != (GNUNET_HELLO_ADDRESS_INFO_INBOUND & session->address->local_info))
479 ? GNUNET_YES
480 : GNUNET_NO;
479 info.num_msg_pending = session->msgs_in_queue; 481 info.num_msg_pending = session->msgs_in_queue;
480 info.num_bytes_pending = session->bytes_in_queue; 482 info.num_bytes_pending = session->bytes_in_queue;
481 if (GNUNET_SCHEDULER_NO_TASK != session->receive_delay_task) 483 if (GNUNET_SCHEDULER_NO_TASK != session->receive_delay_task)
@@ -494,9 +496,9 @@ notify_session_monitor (struct Plugin *plugin,
494 * address and that the next call to this function is allowed 496 * address and that the next call to this function is allowed
495 * to override the address again. 497 * to override the address again.
496 * 498 *
497 * @param cls closure ('struct Plugin*') 499 * @param cls closure (`struct Plugin *`)
498 * @param addr binary address 500 * @param addr binary address
499 * @param addrlen length of the address 501 * @param addrlen length of @a addr
500 * @return string representing the same address 502 * @return string representing the same address
501 */ 503 */
502static const char * 504static const char *
@@ -513,7 +515,7 @@ tcp_plugin_address_to_string (void *cls,
513 * @param cls the `struct Plugin` 515 * @param cls the `struct Plugin`
514 * @param ucred credentials, if available, otherwise NULL 516 * @param ucred credentials, if available, otherwise NULL
515 * @param addr address 517 * @param addr address
516 * @param addrlen length of address 518 * @param addrlen length of @a addr
517 * @return #GNUNET_YES to allow, #GNUNET_NO to deny, #GNUNET_SYSERR 519 * @return #GNUNET_YES to allow, #GNUNET_NO to deny, #GNUNET_SYSERR
518 * for unknown address family (will be denied). 520 * for unknown address family (will be denied).
519 */ 521 */
@@ -2194,10 +2196,11 @@ handle_tcp_nat_probe (void *cls,
2194 t4->options = htonl (TCP_OPTIONS_NONE); 2196 t4->options = htonl (TCP_OPTIONS_NONE);
2195 t4->t4_port = s4->sin_port; 2197 t4->t4_port = s4->sin_port;
2196 t4->ipv4_addr = s4->sin_addr.s_addr; 2198 t4->ipv4_addr = s4->sin_addr.s_addr;
2197 session->address = GNUNET_HELLO_address_allocate ( 2199 session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity,
2198 &tcp_nat_probe->clientIdentity, PLUGIN_NAME, &t4, 2200 PLUGIN_NAME,
2199 sizeof(struct IPv4TcpAddress), 2201 &t4,
2200 GNUNET_HELLO_ADDRESS_INFO_NONE); 2202 sizeof(struct IPv4TcpAddress),
2203 GNUNET_HELLO_ADDRESS_INFO_NONE);
2201 break; 2204 break;
2202 case AF_INET6: 2205 case AF_INET6:
2203 s6 = vaddr; 2206 s6 = vaddr;
@@ -2205,10 +2208,11 @@ handle_tcp_nat_probe (void *cls,
2205 t6->options = htonl (TCP_OPTIONS_NONE); 2208 t6->options = htonl (TCP_OPTIONS_NONE);
2206 t6->t6_port = s6->sin6_port; 2209 t6->t6_port = s6->sin6_port;
2207 memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr)); 2210 memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr));
2208 session->address = GNUNET_HELLO_address_allocate ( 2211 session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity,
2209 &tcp_nat_probe->clientIdentity, 2212 PLUGIN_NAME,
2210 PLUGIN_NAME, &t6, sizeof(struct IPv6TcpAddress), 2213 &t6,
2211 GNUNET_HELLO_ADDRESS_INFO_NONE); 2214 sizeof(struct IPv6TcpAddress),
2215 GNUNET_HELLO_ADDRESS_INFO_NONE);
2212 break; 2216 break;
2213 default: 2217 default:
2214 GNUNET_break_op(0); 2218 GNUNET_break_op(0);
@@ -2305,8 +2309,10 @@ handle_tcp_welcome (void *cls,
2305 t4.t4_port = s4->sin_port; 2309 t4.t4_port = s4->sin_port;
2306 t4.ipv4_addr = s4->sin_addr.s_addr; 2310 t4.ipv4_addr = s4->sin_addr.s_addr;
2307 address = GNUNET_HELLO_address_allocate (&wm->clientIdentity, 2311 address = GNUNET_HELLO_address_allocate (&wm->clientIdentity,
2308 PLUGIN_NAME, &t4, sizeof(t4), 2312 PLUGIN_NAME,
2309 GNUNET_HELLO_ADDRESS_INFO_INBOUND); 2313 &t4,
2314 sizeof(t4),
2315 GNUNET_HELLO_ADDRESS_INFO_INBOUND);
2310 } 2316 }
2311 else if (alen == sizeof(struct sockaddr_in6)) 2317 else if (alen == sizeof(struct sockaddr_in6))
2312 { 2318 {
diff --git a/src/transport/transport_api_monitor_peers.c b/src/transport/transport_api_monitor_peers.c
index f1dab26e2..611580f68 100644
--- a/src/transport/transport_api_monitor_peers.c
+++ b/src/transport/transport_api_monitor_peers.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009, 2010 Christian Grothoff (and other contributing authors) 3 (C) 2009-2014 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
diff --git a/src/transport/transport_api_monitor_plugins.c b/src/transport/transport_api_monitor_plugins.c
index 1bbb4c102..d14323ec6 100644
--- a/src/transport/transport_api_monitor_plugins.c
+++ b/src/transport/transport_api_monitor_plugins.c
@@ -291,6 +291,7 @@ response_processor (void *cls,
291 struct GNUNET_HELLO_Address addr; 291 struct GNUNET_HELLO_Address addr;
292 struct SearchContext rv; 292 struct SearchContext rv;
293 293
294 fprintf (stderr, "R\n");
294 if (NULL == msg) 295 if (NULL == msg)
295 { 296 {
296 reconnect_plugin_ctx (pm); 297 reconnect_plugin_ctx (pm);
@@ -304,6 +305,10 @@ response_processor (void *cls,
304 NULL, 305 NULL,
305 NULL, 306 NULL,
306 NULL); 307 NULL);
308 GNUNET_CLIENT_receive (pm->client,
309 &response_processor,
310 pm,
311 GNUNET_TIME_UNIT_FOREVER_REL);
307 return; 312 return;
308 } 313 }
309 314
@@ -383,6 +388,10 @@ response_processor (void *cls,
383 ps)); 388 ps));
384 GNUNET_free (ps); 389 GNUNET_free (ps);
385 } 390 }
391 GNUNET_CLIENT_receive (pm->client,
392 &response_processor,
393 pm,
394 GNUNET_TIME_UNIT_FOREVER_REL);
386} 395}
387 396
388 397