diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-09-03 18:03:57 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-09-03 18:03:57 +0000 |
commit | 8097b21b3fecd75150c728af94d26818120bf063 (patch) | |
tree | 9ddb80657d1e6478730a400cf43d2c189f4fe7ef /src/cadet/gnunet-service-cadet_channel.c | |
parent | a72b1aaa4971e6d1388e459a0ebc13f1d9330641 (diff) | |
download | gnunet-8097b21b3fecd75150c728af94d26818120bf063.tar.gz gnunet-8097b21b3fecd75150c728af94d26818120bf063.zip |
- use channel debug
Diffstat (limited to 'src/cadet/gnunet-service-cadet_channel.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_channel.c | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 158fc0ea6..715edf6f4 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "gnunet-service-cadet_peer.h" | 33 | #include "gnunet-service-cadet_peer.h" |
34 | 34 | ||
35 | #define LOG(level, ...) GNUNET_log_from(level,"cadet-chn",__VA_ARGS__) | 35 | #define LOG(level, ...) GNUNET_log_from(level,"cadet-chn",__VA_ARGS__) |
36 | #define LOG2(level, ...) GNUNET_log_from_nocheck(level,"cadet-chn",__VA_ARGS__) | ||
36 | 37 | ||
37 | #define CADET_RETRANSMIT_TIME GNUNET_TIME_relative_multiply(\ | 38 | #define CADET_RETRANSMIT_TIME GNUNET_TIME_relative_multiply(\ |
38 | GNUNET_TIME_UNIT_MILLISECONDS, 250) | 39 | GNUNET_TIME_UNIT_MILLISECONDS, 250) |
@@ -1368,7 +1369,7 @@ GCCH_destroy (struct CadetChannel *ch) | |||
1368 | 1369 | ||
1369 | LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying channel %s:%u\n", | 1370 | LOG (GNUNET_ERROR_TYPE_DEBUG, "destroying channel %s:%u\n", |
1370 | GCT_2s (ch->t), ch->gid); | 1371 | GCT_2s (ch->t), ch->gid); |
1371 | GCCH_debug (ch); | 1372 | GCCH_debug (ch, GNUNET_ERROR_TYPE_DEBUG); |
1372 | 1373 | ||
1373 | c = ch->root; | 1374 | c = ch->root; |
1374 | if (NULL != c) | 1375 | if (NULL != c) |
@@ -1437,7 +1438,7 @@ GCCH_get_buffer (struct CadetChannel *ch, int fwd) | |||
1437 | 1438 | ||
1438 | rel = fwd ? ch->dest_rel : ch->root_rel; | 1439 | rel = fwd ? ch->dest_rel : ch->root_rel; |
1439 | LOG (GNUNET_ERROR_TYPE_DEBUG, " get buffer, channel %s\n", GCCH_2s (ch)); | 1440 | LOG (GNUNET_ERROR_TYPE_DEBUG, " get buffer, channel %s\n", GCCH_2s (ch)); |
1440 | GCCH_debug (ch); | 1441 | GCCH_debug (ch, GNUNET_ERROR_TYPE_DEBUG); |
1441 | /* If rel is NULL it means that the end is not yet created, | 1442 | /* If rel is NULL it means that the end is not yet created, |
1442 | * most probably is a loopback channel at the point of sending | 1443 | * most probably is a loopback channel at the point of sending |
1443 | * the ChannelCreate to itself. | 1444 | * the ChannelCreate to itself. |
@@ -1643,40 +1644,45 @@ GCCH_allow_client (struct CadetChannel *ch, int fwd) | |||
1643 | * Log channel info. | 1644 | * Log channel info. |
1644 | * | 1645 | * |
1645 | * @param ch Channel. | 1646 | * @param ch Channel. |
1647 | * @param level Debug level to use. | ||
1646 | */ | 1648 | */ |
1647 | void | 1649 | void |
1648 | GCCH_debug (struct CadetChannel *ch) | 1650 | GCCH_debug (struct CadetChannel *ch, enum GNUNET_ErrorType level) |
1649 | { | 1651 | { |
1652 | int do_log; | ||
1653 | |||
1654 | do_log = GNUNET_get_log_call_status (level & (~GNUNET_ERROR_TYPE_BULK), | ||
1655 | "cadet-chn", | ||
1656 | __FILE__, __FUNCTION__, __LINE__); | ||
1657 | if (0 == do_log) | ||
1658 | return; | ||
1659 | |||
1650 | if (NULL == ch) | 1660 | if (NULL == ch) |
1651 | { | 1661 | { |
1652 | LOG (GNUNET_ERROR_TYPE_DEBUG, "*** DEBUG NULL CHANNEL ***\n"); | 1662 | LOG2 (level, "*** DEBUG NULL CHANNEL ***\n"); |
1653 | return; | 1663 | return; |
1654 | } | 1664 | } |
1655 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel %s:%X (%p)\n", | 1665 | LOG2 (level, "Channel %s:%X (%p)\n", GCT_2s (ch->t), ch->gid, ch); |
1656 | GCT_2s (ch->t), ch->gid, ch); | 1666 | LOG2 (level, " root %p/%p\n", ch->root, ch->root_rel); |
1657 | LOG (GNUNET_ERROR_TYPE_DEBUG, " root %p/%p\n", | ||
1658 | ch->root, ch->root_rel); | ||
1659 | if (NULL != ch->root) | 1667 | if (NULL != ch->root) |
1660 | { | 1668 | { |
1661 | LOG (GNUNET_ERROR_TYPE_DEBUG, " cli %s\n", GML_2s (ch->root)); | 1669 | LOG2 (level, " cli %s\n", GML_2s (ch->root)); |
1662 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ready %s\n", | 1670 | LOG2 (level, " ready %s\n", ch->root_rel->client_ready ? "YES" : "NO"); |
1663 | ch->root_rel->client_ready ? "YES" : "NO"); | 1671 | LOG2 (level, " id %X\n", ch->lid_root); |
1664 | LOG (GNUNET_ERROR_TYPE_DEBUG, " id %X\n", ch->lid_root); | 1672 | LOG2 (level, " recv %d\n", ch->root_rel->n_recv); |
1665 | LOG (GNUNET_ERROR_TYPE_DEBUG, " recv %d\n", ch->root_rel->n_recv); | 1673 | LOG2 (level, " MID r: %d, s: %d\n", |
1666 | LOG (GNUNET_ERROR_TYPE_DEBUG, " MID r: %d, s: %d\n", | 1674 | ch->root_rel->mid_recv, ch->root_rel->mid_send); |
1667 | ch->root_rel->mid_recv, ch->root_rel->mid_send); | ||
1668 | } | 1675 | } |
1669 | LOG (GNUNET_ERROR_TYPE_DEBUG, " dest %p/%p\n", | 1676 | LOG2 (level, " dest %p/%p\n", |
1670 | ch->dest, ch->dest_rel); | 1677 | ch->dest, ch->dest_rel); |
1671 | if (NULL != ch->dest) | 1678 | if (NULL != ch->dest) |
1672 | { | 1679 | { |
1673 | LOG (GNUNET_ERROR_TYPE_DEBUG, " cli %s\n", GML_2s (ch->dest)); | 1680 | LOG2 (level, " cli %s\n", GML_2s (ch->dest)); |
1674 | LOG (GNUNET_ERROR_TYPE_DEBUG, " ready %s\n", | 1681 | LOG2 (level, " ready %s\n", ch->dest_rel->client_ready ? "YES" : "NO"); |
1675 | ch->dest_rel->client_ready ? "YES" : "NO"); | 1682 | LOG2 (level, " id %X\n", ch->lid_dest); |
1676 | LOG (GNUNET_ERROR_TYPE_DEBUG, " id %X\n", ch->lid_dest); | 1683 | LOG2 (level, " recv %d\n", ch->dest_rel->n_recv); |
1677 | LOG (GNUNET_ERROR_TYPE_DEBUG, " recv %d\n", ch->dest_rel->n_recv); | 1684 | LOG2 (level, " MID r: %d, s: %d\n", |
1678 | LOG (GNUNET_ERROR_TYPE_DEBUG, " MID r: %d, s: %d\n", | 1685 | ch->dest_rel->mid_recv, ch->dest_rel->mid_send); |
1679 | ch->dest_rel->mid_recv, ch->dest_rel->mid_send); | ||
1680 | 1686 | ||
1681 | } | 1687 | } |
1682 | } | 1688 | } |
@@ -2290,7 +2296,7 @@ GCCH_handle_destroy (struct CadetChannel *ch, | |||
2290 | fwd = (NULL != ch->dest) ? GNUNET_YES : GNUNET_NO; | 2296 | fwd = (NULL != ch->dest) ? GNUNET_YES : GNUNET_NO; |
2291 | } | 2297 | } |
2292 | 2298 | ||
2293 | GCCH_debug (ch); | 2299 | GCCH_debug (ch, GNUNET_ERROR_TYPE_DEBUG); |
2294 | if ( (fwd && NULL == ch->dest) || (!fwd && NULL == ch->root) ) | 2300 | if ( (fwd && NULL == ch->dest) || (!fwd && NULL == ch->root) ) |
2295 | { | 2301 | { |
2296 | /* Not for us (don't destroy twice a half-open loopback channel) */ | 2302 | /* Not for us (don't destroy twice a half-open loopback channel) */ |