gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r34422 - in gnunet/src: transport util


From: gnunet
Subject: [GNUnet-SVN] r34422 - in gnunet/src: transport util
Date: Sun, 23 Nov 2014 21:12:33 +0100

Author: grothoff
Date: 2014-11-23 21:12:32 +0100 (Sun, 23 Nov 2014)
New Revision: 34422

Modified:
   gnunet/src/transport/gnunet-service-transport_clients.c
   gnunet/src/transport/gnunet-service-transport_plugins.c
   gnunet/src/transport/gnunet-transport.c
   gnunet/src/transport/plugin_transport_tcp.c
   gnunet/src/transport/transport_api_monitor_peers.c
   gnunet/src/transport/transport_api_monitor_plugins.c
   gnunet/src/util/client.c
Log:
-fix misc monitoring issues

Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c     2014-11-23 
19:24:55 UTC (rev 34421)
+++ gnunet/src/transport/gnunet-service-transport_clients.c     2014-11-23 
20:12:32 UTC (rev 34422)
@@ -1235,7 +1235,6 @@
 }
 
 
-
 /**
  * Client asked to obtain information about a specific or all peers
  * Process the request.
@@ -1399,6 +1398,7 @@
 
   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 @@
 {
   GNUNET_SERVER_client_mark_monitor (client);
   GNUNET_SERVER_disable_receive_done_warning (client);
-  if (0 == GNUNET_SERVER_notification_context_get_size (plugin_nc))
+  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);
-  GNUNET_SERVER_notification_context_add (plugin_nc, client);
 }
 
 
@@ -1557,7 +1557,8 @@
  * @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 @@
  */
 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 @@
                                          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);

Modified: gnunet/src/transport/gnunet-service-transport_plugins.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_plugins.c     2014-11-23 
19:24:55 UTC (rev 34421)
+++ gnunet/src/transport/gnunet-service-transport_plugins.c     2014-11-23 
20:12:32 UTC (rev 34422)
@@ -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_tail;
 
 
-
 /**
  * Load and initialize all plugins.  The respective functions will be
  * invoked by the plugins when the respective events happen.  The

Modified: gnunet/src/transport/gnunet-transport.c
===================================================================
--- gnunet/src/transport/gnunet-transport.c     2014-11-23 19:24:55 UTC (rev 
34421)
+++ gnunet/src/transport/gnunet-transport.c     2014-11-23 20:12:32 UTC (rev 
34422)
@@ -1599,9 +1599,12 @@
   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,

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2014-11-23 19:24:55 UTC (rev 
34421)
+++ gnunet/src/transport/plugin_transport_tcp.c 2014-11-23 20:12:32 UTC (rev 
34422)
@@ -475,7 +475,9 @@
     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 @@
  * 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 @@
  * @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 @@
     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 @@
     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 @@
         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))
       {

Modified: gnunet/src/transport/transport_api_monitor_peers.c
===================================================================
--- gnunet/src/transport/transport_api_monitor_peers.c  2014-11-23 19:24:55 UTC 
(rev 34421)
+++ gnunet/src/transport/transport_api_monitor_peers.c  2014-11-23 20:12:32 UTC 
(rev 34422)
@@ -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

Modified: gnunet/src/transport/transport_api_monitor_plugins.c
===================================================================
--- gnunet/src/transport/transport_api_monitor_plugins.c        2014-11-23 
19:24:55 UTC (rev 34421)
+++ gnunet/src/transport/transport_api_monitor_plugins.c        2014-11-23 
20:12:32 UTC (rev 34422)
@@ -291,6 +291,7 @@
   struct GNUNET_HELLO_Address addr;
   struct SearchContext rv;
 
+  fprintf (stderr, "R\n");
   if (NULL == msg)
   {
     reconnect_plugin_ctx (pm);
@@ -304,6 +305,10 @@
             NULL,
             NULL,
             NULL);
+    GNUNET_CLIENT_receive (pm->client,
+                           &response_processor,
+                           pm,
+                           GNUNET_TIME_UNIT_FOREVER_REL);
     return;
   }
 
@@ -383,6 +388,10 @@
                                                            ps));
     GNUNET_free (ps);
   }
+  GNUNET_CLIENT_receive (pm->client,
+                         &response_processor,
+                         pm,
+                         GNUNET_TIME_UNIT_FOREVER_REL);
 }
 
 

Modified: gnunet/src/util/client.c
===================================================================
--- gnunet/src/util/client.c    2014-11-23 19:24:55 UTC (rev 34421)
+++ gnunet/src/util/client.c    2014-11-23 20:12:32 UTC (rev 34422)
@@ -217,7 +217,7 @@
 
   /**
    * 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;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]