gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37676 - in gnunet/src: cadet include util


From: gnunet
Subject: [GNUnet-SVN] r37676 - in gnunet/src: cadet include util
Date: Mon, 8 Aug 2016 21:51:46 +0200

Author: lynx
Date: 2016-08-08 21:51:46 +0200 (Mon, 08 Aug 2016)
New Revision: 37676

Modified:
   gnunet/src/cadet/gnunet-cadet.c
   gnunet/src/cadet/gnunet-service-cadet_local.c
   gnunet/src/include/gnunet_common.h
   gnunet/src/util/common_logging.c
Log:
Merge branch 'master' of /RAM/proj/gnunet

Modified: gnunet/src/cadet/gnunet-cadet.c
===================================================================
--- gnunet/src/cadet/gnunet-cadet.c     2016-08-08 13:17:24 UTC (rev 37675)
+++ gnunet/src/cadet/gnunet-cadet.c     2016-08-08 19:51:46 UTC (rev 37676)
@@ -65,7 +65,7 @@
 static char *channel_id;
 
 /**
- * Port to listen on (-p).
+ * Port to listen on (-o).
  */
 static uint32_t listen_port;
 
@@ -120,6 +120,11 @@
 static struct GNUNET_CADET_TransmitHandle *th;
 
 /**
+ * Data structure for ongoing reception of incoming virtual circuits.
+ */
+struct GNUNET_CADET_Port *lp;
+
+/**
  * Shutdown task handle.
  */
 static struct GNUNET_SCHEDULER_Task *sd;
@@ -376,8 +381,8 @@
  * Only called (once) upon reception of data with a message type which was
  * subscribed to in #GNUNET_CADET_connect.
  *
- * A call to #GNUNET_CADET_channel_destroy causes te channel to be ignored. In
- * this case the handler MUST return NULL.
+ * A call to #GNUNET_CADET_channel_destroy causes the channel to be ignored.
+ * In this case the handler MUST return NULL.
  *
  * @param cls closure
  * @param channel new handle to the channel
@@ -395,9 +400,9 @@
                   const struct GNUNET_HashCode *port,
                   enum GNUNET_CADET_ChannelOption options)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Incoming channel %p on port %s\n",
-              channel, GNUNET_h2s (port));
+  GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+              "Incoming channel %p from %s on port %s\n",
+              channel, GNUNET_i2s_full (initiator), GNUNET_h2s (port));
   if (NULL != ch)
   {
     GNUNET_break (0);
@@ -409,9 +414,15 @@
   }
   if (0 == listen_port)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Not listening to channels\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Not listening to channels\n");
     return NULL;
   }
+  if (NULL != lp) {
+    /* Now that we have our circuit up and running, let's not
+     * get confused by further incoming circuits.
+     */
+    GNUNET_CADET_close_port (lp);
+  }
   ch = channel;
   if (GNUNET_NO == echo)
   {
@@ -901,13 +912,13 @@
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Show all tunnels\n");
     job = GNUNET_SCHEDULER_add_now (&get_tunnels, NULL);
   }
-  else
+  else if (0 == listen_port)
   {
     FPRINTF (stderr, "No action requested\n");
     return;
   }
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to cadet\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to CADET service\n");
   mh = GNUNET_CADET_connect (cfg,
                             NULL, /* cls */
                             &channel_ended, /* cleaner */
@@ -919,9 +930,9 @@
 
   if (0 != listen_port)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Opening listen port\n");
-    GNUNET_CADET_open_port (mh, GC_u2h (listen_port),
-                           &channel_incoming, NULL);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Opening CADET listen port\n");
+    lp = GNUNET_CADET_open_port (mh, GC_u2h (listen_port),
+                                &channel_incoming, NULL);
   }
 }
 
@@ -955,7 +966,7 @@
 //      gettext_noop ("provide information about all events (continuously)"),
 //      GNUNET_NO, &GNUNET_GETOPT_set_one, &monitor_mode},
     {'o', "open-port", NULL,
-     gettext_noop ("port to listen to (default; 0)"),
+     gettext_noop ("port to listen to"),
      GNUNET_YES, &GNUNET_GETOPT_set_uint, &listen_port},
     {'p', "peer", "PEER_ID",
      gettext_noop ("provide information about a patricular peer"),

Modified: gnunet/src/cadet/gnunet-service-cadet_local.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_local.c       2016-08-08 13:17:24 UTC 
(rev 37675)
+++ gnunet/src/cadet/gnunet-service-cadet_local.c       2016-08-08 19:51:46 UTC 
(rev 37676)
@@ -379,6 +379,7 @@
 handle_port_close (void *cls, struct GNUNET_SERVER_Client *client,
                    const struct GNUNET_MessageHeader *message)
 {
+       // FIXME
 }
 
 

Modified: gnunet/src/include/gnunet_common.h
===================================================================
--- gnunet/src/include/gnunet_common.h  2016-08-08 13:17:24 UTC (rev 37675)
+++ gnunet/src/include/gnunet_common.h  2016-08-08 19:51:46 UTC (rev 37676)
@@ -332,10 +332,14 @@
   GNUNET_ERROR_TYPE_NONE = 0,
   GNUNET_ERROR_TYPE_ERROR = 1,
   GNUNET_ERROR_TYPE_WARNING = 2,
-  GNUNET_ERROR_TYPE_INFO = 4,
-  GNUNET_ERROR_TYPE_DEBUG = 8,
-  GNUNET_ERROR_TYPE_INVALID = 16,
-  GNUNET_ERROR_TYPE_BULK = 32
+  /* UX: We need a message type that is output by
+   * default without looking like there is a problem.
+   */
+  GNUNET_ERROR_TYPE_MESSAGE = 4,
+  GNUNET_ERROR_TYPE_INFO = 8,
+  GNUNET_ERROR_TYPE_DEBUG = 16,
+  GNUNET_ERROR_TYPE_INVALID = 32,
+  GNUNET_ERROR_TYPE_BULK = 64
 };
 
 

Modified: gnunet/src/util/common_logging.c
===================================================================
--- gnunet/src/util/common_logging.c    2016-08-08 13:17:24 UTC (rev 37675)
+++ gnunet/src/util/common_logging.c    2016-08-08 19:51:46 UTC (rev 37676)
@@ -256,6 +256,8 @@
   if (0 == strcasecmp (log, _("DEBUG")))
     return GNUNET_ERROR_TYPE_DEBUG;
   if (0 == strcasecmp (log, _("INFO")))
+    return GNUNET_ERROR_TYPE_MESSAGE;
+  if (0 == strcasecmp (log, _("MESSAGE")))
     return GNUNET_ERROR_TYPE_INFO;
   if (0 == strcasecmp (log, _("WARNING")))
     return GNUNET_ERROR_TYPE_WARNING;
@@ -520,9 +522,10 @@
   if (min_level >= 0)
     return caller_level <= min_level;
   /* All programs/services previously defaulted to WARNING.
-   * Now WE default to WARNING, and THEY default to NULL.
+   * Now *we* default to WARNING, and THEY default to NULL.
+   * Or rather we default to MESSAGE, since things aren't always bad.
    */
-  return caller_level <= GNUNET_ERROR_TYPE_WARNING;
+  return caller_level <= GNUNET_ERROR_TYPE_MESSAGE;
 }
 
 
@@ -1066,6 +1069,8 @@
     return _("ERROR");
   if ((kind & GNUNET_ERROR_TYPE_WARNING) > 0)
     return _("WARNING");
+  if ((kind & GNUNET_ERROR_TYPE_MESSAGE) > 0)
+    return _("MESSAGE");
   if ((kind & GNUNET_ERROR_TYPE_INFO) > 0)
     return _("INFO");
   if ((kind & GNUNET_ERROR_TYPE_DEBUG) > 0)




reply via email to

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