summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-11-23 20:12:32 +0000
committerChristian Grothoff <christian@grothoff.org>2014-11-23 20:12:32 +0000
commitd60c79921cb80f2173d800785ec5d39f6cdbca8c (patch)
tree0aec29c3348c2daf8babd979963b1212e6fabcfb
parente5d9d0d24bc32dcebcd5d2f86ca5cca579bc5dbb (diff)
-fix misc monitoring issues
-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
-rw-r--r--src/util/client.c2
7 files changed, 44 insertions, 24 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,
}
-
/**
* Client asked to obtain information about a specific or all peers
* Process the request.
@@ -1399,6 +1398,7 @@ plugin_session_info_cb (void *cls,
if (0 == GNUNET_SERVER_notification_context_get_size (plugin_nc))
{
+ fprintf (stderr, "UNSUB!\n");
GST_plugins_monitor_subscribe (NULL, NULL);
return;
}
@@ -1463,9 +1463,9 @@ clients_handle_monitor_plugins (void *cls,
{
GNUNET_SERVER_client_mark_monitor (client);
GNUNET_SERVER_disable_receive_done_warning (client);
- if (0 == GNUNET_SERVER_notification_context_get_size (plugin_nc))
- GST_plugins_monitor_subscribe (&plugin_session_info_cb, NULL);
GNUNET_SERVER_notification_context_add (plugin_nc, client);
+ if (1 == GNUNET_SERVER_notification_context_get_size (plugin_nc))
+ GST_plugins_monitor_subscribe (&plugin_session_info_cb, NULL);
}
@@ -1557,7 +1557,8 @@ GST_clients_stop ()
* @param may_drop #GNUNET_YES if the message can be dropped / is payload
*/
void
-GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, int may_drop)
+GST_clients_broadcast (const struct GNUNET_MessageHeader *msg,
+ int may_drop)
{
struct TransportClient *tc;
@@ -1579,7 +1580,8 @@ GST_clients_broadcast (const struct GNUNET_MessageHeader *msg, int may_drop)
*/
void
GST_clients_unicast (struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *msg, int may_drop)
+ const struct GNUNET_MessageHeader *msg,
+ int may_drop)
{
struct TransportClient *tc;
@@ -1604,9 +1606,10 @@ GST_clients_broadcast_peer_notification (const struct GNUNET_PeerIdentity *peer,
enum GNUNET_TRANSPORT_PeerState state,
struct GNUNET_TIME_Absolute state_timeout)
{
+ static struct GNUNET_PeerIdentity all_zeros;
struct PeerIterateResponseMessage *msg;
struct MonitoringClient *mc;
- static struct GNUNET_PeerIdentity all_zeros;
+
msg = compose_address_iterate_response_message (peer, address);
msg->state = htonl (state);
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 @@
/*
This file is part of GNUnet.
(C) 2010-2014 Christian Grothoff (and other contributing authors)
-
+
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your
@@ -78,7 +78,6 @@ static struct TransportPlugin *plugins_head;
static struct TransportPlugin *plugins_tail;
-
/**
* Load and initialize all plugins. The respective functions will be
* 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,
const char *state;
struct PluginMonitorAddress *addr;
+ fprintf (stderr, "E!\n");
if ( (NULL == info) &&
(NULL == session) )
return; /* in sync with transport service */
+ if (NULL == info)
+ return; /* shutdown */
if ( (NULL != cpid) &&
(0 != memcmp (&info->address->peer,
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,
return;
memset (&info, 0, sizeof (info));
info.state = state;
- info.is_inbound = GNUNET_SYSERR; /* hard to say */
+ info.is_inbound = (0 != (GNUNET_HELLO_ADDRESS_INFO_INBOUND & session->address->local_info))
+ ? GNUNET_YES
+ : GNUNET_NO;
info.num_msg_pending = session->msgs_in_queue;
info.num_bytes_pending = session->bytes_in_queue;
if (GNUNET_SCHEDULER_NO_TASK != session->receive_delay_task)
@@ -494,9 +496,9 @@ notify_session_monitor (struct Plugin *plugin,
* address and that the next call to this function is allowed
* to override the address again.
*
- * @param cls closure ('struct Plugin*')
+ * @param cls closure (`struct Plugin *`)
* @param addr binary address
- * @param addrlen length of the address
+ * @param addrlen length of @a addr
* @return string representing the same address
*/
static const char *
@@ -513,7 +515,7 @@ tcp_plugin_address_to_string (void *cls,
* @param cls the `struct Plugin`
* @param ucred credentials, if available, otherwise NULL
* @param addr address
- * @param addrlen length of address
+ * @param addrlen length of @a addr
* @return #GNUNET_YES to allow, #GNUNET_NO to deny, #GNUNET_SYSERR
* for unknown address family (will be denied).
*/
@@ -2194,10 +2196,11 @@ handle_tcp_nat_probe (void *cls,
t4->options = htonl (TCP_OPTIONS_NONE);
t4->t4_port = s4->sin_port;
t4->ipv4_addr = s4->sin_addr.s_addr;
- session->address = GNUNET_HELLO_address_allocate (
- &tcp_nat_probe->clientIdentity, PLUGIN_NAME, &t4,
- sizeof(struct IPv4TcpAddress),
- GNUNET_HELLO_ADDRESS_INFO_NONE);
+ session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity,
+ PLUGIN_NAME,
+ &t4,
+ sizeof(struct IPv4TcpAddress),
+ GNUNET_HELLO_ADDRESS_INFO_NONE);
break;
case AF_INET6:
s6 = vaddr;
@@ -2205,10 +2208,11 @@ handle_tcp_nat_probe (void *cls,
t6->options = htonl (TCP_OPTIONS_NONE);
t6->t6_port = s6->sin6_port;
memcpy (&t6->ipv6_addr, &s6->sin6_addr, sizeof(struct in6_addr));
- session->address = GNUNET_HELLO_address_allocate (
- &tcp_nat_probe->clientIdentity,
- PLUGIN_NAME, &t6, sizeof(struct IPv6TcpAddress),
- GNUNET_HELLO_ADDRESS_INFO_NONE);
+ session->address = GNUNET_HELLO_address_allocate (&tcp_nat_probe->clientIdentity,
+ PLUGIN_NAME,
+ &t6,
+ sizeof(struct IPv6TcpAddress),
+ GNUNET_HELLO_ADDRESS_INFO_NONE);
break;
default:
GNUNET_break_op(0);
@@ -2305,8 +2309,10 @@ handle_tcp_welcome (void *cls,
t4.t4_port = s4->sin_port;
t4.ipv4_addr = s4->sin_addr.s_addr;
address = GNUNET_HELLO_address_allocate (&wm->clientIdentity,
- PLUGIN_NAME, &t4, sizeof(t4),
- GNUNET_HELLO_ADDRESS_INFO_INBOUND);
+ PLUGIN_NAME,
+ &t4,
+ sizeof(t4),
+ GNUNET_HELLO_ADDRESS_INFO_INBOUND);
}
else if (alen == sizeof(struct sockaddr_in6))
{
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 @@
/*
This file is part of GNUnet.
- (C) 2009, 2010 Christian Grothoff (and other contributing authors)
+ (C) 2009-2014 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
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,
struct GNUNET_HELLO_Address addr;
struct SearchContext rv;
+ fprintf (stderr, "R\n");
if (NULL == msg)
{
reconnect_plugin_ctx (pm);
@@ -304,6 +305,10 @@ response_processor (void *cls,
NULL,
NULL,
NULL);
+ GNUNET_CLIENT_receive (pm->client,
+ &response_processor,
+ pm,
+ GNUNET_TIME_UNIT_FOREVER_REL);
return;
}
@@ -383,6 +388,10 @@ response_processor (void *cls,
ps));
GNUNET_free (ps);
}
+ GNUNET_CLIENT_receive (pm->client,
+ &response_processor,
+ pm,
+ GNUNET_TIME_UNIT_FOREVER_REL);
}
diff --git a/src/util/client.c b/src/util/client.c
index 15d52ec60..018411d1e 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -217,7 +217,7 @@ struct GNUNET_CLIENT_Connection
/**
* Are we currently busy doing receive-processing?
- * GNUNET_YES if so, GNUNET_NO if not.
+ * #GNUNET_YES if so, #GNUNET_NO if not.
*/
int in_receive;