static char *channel_id;
/**
- * Port to listen on (-p).
+ * Port to listen on (-o).
*/
static uint32_t listen_port;
*/
static struct GNUNET_CADET_TransmitHandle *th;
+/**
+ * Data structure for ongoing reception of incoming virtual circuits.
+ */
+struct GNUNET_CADET_Port *lp;
+
/**
* Shutdown task handle.
*/
* 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
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);
}
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)
{
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 */
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);
}
}
// 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"),
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
};
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;
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;
}
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)