aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlo von lynX <lynX@time.to.get.psyced.org>2016-08-08 19:51:46 +0000
committerCarlo von lynX <lynX@time.to.get.psyced.org>2016-08-08 19:51:46 +0000
commit06f44db8a9a4c1b6b4a2a4a707067feb7164e609 (patch)
tree70d992450fe010e5ef8c2fd8882b745bb8841772 /src
parent86a3fcdd55ad2cb221fbc2d495a90def1532b01a (diff)
downloadgnunet-06f44db8a9a4c1b6b4a2a4a707067feb7164e609.tar.gz
gnunet-06f44db8a9a4c1b6b4a2a4a707067feb7164e609.zip
Merge branch 'master' of /RAM/proj/gnunet
Diffstat (limited to 'src')
-rw-r--r--src/cadet/gnunet-cadet.c37
-rw-r--r--src/cadet/gnunet-service-cadet_local.c1
-rw-r--r--src/include/gnunet_common.h12
-rw-r--r--src/util/common_logging.c9
4 files changed, 40 insertions, 19 deletions
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c
index 4801dbbdf..88ee41096 100644
--- a/src/cadet/gnunet-cadet.c
+++ b/src/cadet/gnunet-cadet.c
@@ -65,7 +65,7 @@ static char *conn_id;
65static char *channel_id; 65static char *channel_id;
66 66
67/** 67/**
68 * Port to listen on (-p). 68 * Port to listen on (-o).
69 */ 69 */
70static uint32_t listen_port; 70static uint32_t listen_port;
71 71
@@ -120,6 +120,11 @@ static struct GNUNET_CADET_Channel *ch;
120static struct GNUNET_CADET_TransmitHandle *th; 120static struct GNUNET_CADET_TransmitHandle *th;
121 121
122/** 122/**
123 * Data structure for ongoing reception of incoming virtual circuits.
124 */
125struct GNUNET_CADET_Port *lp;
126
127/**
123 * Shutdown task handle. 128 * Shutdown task handle.
124 */ 129 */
125static struct GNUNET_SCHEDULER_Task *sd; 130static struct GNUNET_SCHEDULER_Task *sd;
@@ -376,8 +381,8 @@ channel_ended (void *cls,
376 * Only called (once) upon reception of data with a message type which was 381 * Only called (once) upon reception of data with a message type which was
377 * subscribed to in #GNUNET_CADET_connect. 382 * subscribed to in #GNUNET_CADET_connect.
378 * 383 *
379 * A call to #GNUNET_CADET_channel_destroy causes te channel to be ignored. In 384 * A call to #GNUNET_CADET_channel_destroy causes the channel to be ignored.
380 * this case the handler MUST return NULL. 385 * In this case the handler MUST return NULL.
381 * 386 *
382 * @param cls closure 387 * @param cls closure
383 * @param channel new handle to the channel 388 * @param channel new handle to the channel
@@ -395,9 +400,9 @@ channel_incoming (void *cls,
395 const struct GNUNET_HashCode *port, 400 const struct GNUNET_HashCode *port,
396 enum GNUNET_CADET_ChannelOption options) 401 enum GNUNET_CADET_ChannelOption options)
397{ 402{
398 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 403 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
399 "Incoming channel %p on port %s\n", 404 "Incoming channel %p from %s on port %s\n",
400 channel, GNUNET_h2s (port)); 405 channel, GNUNET_i2s_full (initiator), GNUNET_h2s (port));
401 if (NULL != ch) 406 if (NULL != ch)
402 { 407 {
403 GNUNET_break (0); 408 GNUNET_break (0);
@@ -409,9 +414,15 @@ channel_incoming (void *cls,
409 } 414 }
410 if (0 == listen_port) 415 if (0 == listen_port)
411 { 416 {
412 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Not listening to channels\n"); 417 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Not listening to channels\n");
413 return NULL; 418 return NULL;
414 } 419 }
420 if (NULL != lp) {
421 /* Now that we have our circuit up and running, let's not
422 * get confused by further incoming circuits.
423 */
424 GNUNET_CADET_close_port (lp);
425 }
415 ch = channel; 426 ch = channel;
416 if (GNUNET_NO == echo) 427 if (GNUNET_NO == echo)
417 { 428 {
@@ -901,13 +912,13 @@ run (void *cls,
901 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Show all tunnels\n"); 912 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Show all tunnels\n");
902 job = GNUNET_SCHEDULER_add_now (&get_tunnels, NULL); 913 job = GNUNET_SCHEDULER_add_now (&get_tunnels, NULL);
903 } 914 }
904 else 915 else if (0 == listen_port)
905 { 916 {
906 FPRINTF (stderr, "No action requested\n"); 917 FPRINTF (stderr, "No action requested\n");
907 return; 918 return;
908 } 919 }
909 920
910 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to cadet\n"); 921 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to CADET service\n");
911 mh = GNUNET_CADET_connect (cfg, 922 mh = GNUNET_CADET_connect (cfg,
912 NULL, /* cls */ 923 NULL, /* cls */
913 &channel_ended, /* cleaner */ 924 &channel_ended, /* cleaner */
@@ -919,9 +930,9 @@ run (void *cls,
919 930
920 if (0 != listen_port) 931 if (0 != listen_port)
921 { 932 {
922 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Opening listen port\n"); 933 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Opening CADET listen port\n");
923 GNUNET_CADET_open_port (mh, GC_u2h (listen_port), 934 lp = GNUNET_CADET_open_port (mh, GC_u2h (listen_port),
924 &channel_incoming, NULL); 935 &channel_incoming, NULL);
925 } 936 }
926} 937}
927 938
@@ -955,7 +966,7 @@ main (int argc, char *const *argv)
955// gettext_noop ("provide information about all events (continuously)"), 966// gettext_noop ("provide information about all events (continuously)"),
956// GNUNET_NO, &GNUNET_GETOPT_set_one, &monitor_mode}, 967// GNUNET_NO, &GNUNET_GETOPT_set_one, &monitor_mode},
957 {'o', "open-port", NULL, 968 {'o', "open-port", NULL,
958 gettext_noop ("port to listen to (default; 0)"), 969 gettext_noop ("port to listen to"),
959 GNUNET_YES, &GNUNET_GETOPT_set_uint, &listen_port}, 970 GNUNET_YES, &GNUNET_GETOPT_set_uint, &listen_port},
960 {'p', "peer", "PEER_ID", 971 {'p', "peer", "PEER_ID",
961 gettext_noop ("provide information about a patricular peer"), 972 gettext_noop ("provide information about a patricular peer"),
diff --git a/src/cadet/gnunet-service-cadet_local.c b/src/cadet/gnunet-service-cadet_local.c
index d2efb7bef..c6e2fe30d 100644
--- a/src/cadet/gnunet-service-cadet_local.c
+++ b/src/cadet/gnunet-service-cadet_local.c
@@ -379,6 +379,7 @@ static void
379handle_port_close (void *cls, struct GNUNET_SERVER_Client *client, 379handle_port_close (void *cls, struct GNUNET_SERVER_Client *client,
380 const struct GNUNET_MessageHeader *message) 380 const struct GNUNET_MessageHeader *message)
381{ 381{
382 // FIXME
382} 383}
383 384
384 385
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 52322e05e..5b2338998 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -332,10 +332,14 @@ enum GNUNET_ErrorType
332 GNUNET_ERROR_TYPE_NONE = 0, 332 GNUNET_ERROR_TYPE_NONE = 0,
333 GNUNET_ERROR_TYPE_ERROR = 1, 333 GNUNET_ERROR_TYPE_ERROR = 1,
334 GNUNET_ERROR_TYPE_WARNING = 2, 334 GNUNET_ERROR_TYPE_WARNING = 2,
335 GNUNET_ERROR_TYPE_INFO = 4, 335 /* UX: We need a message type that is output by
336 GNUNET_ERROR_TYPE_DEBUG = 8, 336 * default without looking like there is a problem.
337 GNUNET_ERROR_TYPE_INVALID = 16, 337 */
338 GNUNET_ERROR_TYPE_BULK = 32 338 GNUNET_ERROR_TYPE_MESSAGE = 4,
339 GNUNET_ERROR_TYPE_INFO = 8,
340 GNUNET_ERROR_TYPE_DEBUG = 16,
341 GNUNET_ERROR_TYPE_INVALID = 32,
342 GNUNET_ERROR_TYPE_BULK = 64
339}; 343};
340 344
341 345
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 4d78f4898..a80081011 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -256,6 +256,8 @@ get_type (const char *log)
256 if (0 == strcasecmp (log, _("DEBUG"))) 256 if (0 == strcasecmp (log, _("DEBUG")))
257 return GNUNET_ERROR_TYPE_DEBUG; 257 return GNUNET_ERROR_TYPE_DEBUG;
258 if (0 == strcasecmp (log, _("INFO"))) 258 if (0 == strcasecmp (log, _("INFO")))
259 return GNUNET_ERROR_TYPE_MESSAGE;
260 if (0 == strcasecmp (log, _("MESSAGE")))
259 return GNUNET_ERROR_TYPE_INFO; 261 return GNUNET_ERROR_TYPE_INFO;
260 if (0 == strcasecmp (log, _("WARNING"))) 262 if (0 == strcasecmp (log, _("WARNING")))
261 return GNUNET_ERROR_TYPE_WARNING; 263 return GNUNET_ERROR_TYPE_WARNING;
@@ -520,9 +522,10 @@ GNUNET_get_log_call_status (int caller_level,
520 if (min_level >= 0) 522 if (min_level >= 0)
521 return caller_level <= min_level; 523 return caller_level <= min_level;
522 /* All programs/services previously defaulted to WARNING. 524 /* All programs/services previously defaulted to WARNING.
523 * Now WE default to WARNING, and THEY default to NULL. 525 * Now *we* default to WARNING, and THEY default to NULL.
526 * Or rather we default to MESSAGE, since things aren't always bad.
524 */ 527 */
525 return caller_level <= GNUNET_ERROR_TYPE_WARNING; 528 return caller_level <= GNUNET_ERROR_TYPE_MESSAGE;
526} 529}
527 530
528 531
@@ -1066,6 +1069,8 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind)
1066 return _("ERROR"); 1069 return _("ERROR");
1067 if ((kind & GNUNET_ERROR_TYPE_WARNING) > 0) 1070 if ((kind & GNUNET_ERROR_TYPE_WARNING) > 0)
1068 return _("WARNING"); 1071 return _("WARNING");
1072 if ((kind & GNUNET_ERROR_TYPE_MESSAGE) > 0)
1073 return _("MESSAGE");
1069 if ((kind & GNUNET_ERROR_TYPE_INFO) > 0) 1074 if ((kind & GNUNET_ERROR_TYPE_INFO) > 0)
1070 return _("INFO"); 1075 return _("INFO");
1071 if ((kind & GNUNET_ERROR_TYPE_DEBUG) > 0) 1076 if ((kind & GNUNET_ERROR_TYPE_DEBUG) > 0)