diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-17 17:18:53 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-17 17:18:53 +0100 |
commit | f9b01d9c8eeac932db6357426f8a70bf525a4e07 (patch) | |
tree | f3023b6cfe959a38ed5d9ab131fc8e1c62d136ea /src/cadet/gnunet-service-cadet-new.c | |
parent | 100e16ba31dac7138413bda3389d30b3575a8b8e (diff) | |
download | gnunet-f9b01d9c8eeac932db6357426f8a70bf525a4e07.tar.gz gnunet-f9b01d9c8eeac932db6357426f8a70bf525a4e07.zip |
use new shortmap to simplify CADET logic a bit
Diffstat (limited to 'src/cadet/gnunet-service-cadet-new.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet-new.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/cadet/gnunet-service-cadet-new.c b/src/cadet/gnunet-service-cadet-new.c index ad68f09b1..c8cd2fc63 100644 --- a/src/cadet/gnunet-service-cadet-new.c +++ b/src/cadet/gnunet-service-cadet-new.c | |||
@@ -172,9 +172,10 @@ struct GNUNET_CONTAINER_MultiHashMap *loose_channels; | |||
172 | struct GNUNET_CONTAINER_MultiPeerMap *peers; | 172 | struct GNUNET_CONTAINER_MultiPeerMap *peers; |
173 | 173 | ||
174 | /** | 174 | /** |
175 | * Map from expanded connection hash codes to `struct CadetConnection` objects. | 175 | * Map from `struct GNUNET_CADET_ConnectionTunnelIdentifier` |
176 | * hash codes to `struct CadetConnection` objects. | ||
176 | */ | 177 | */ |
177 | struct GNUNET_CONTAINER_MultiHashMap *connections; | 178 | struct GNUNET_CONTAINER_MultiShortmap *connections; |
178 | 179 | ||
179 | /** | 180 | /** |
180 | * How many messages are needed to trigger an AXOLOTL ratchet advance. | 181 | * How many messages are needed to trigger an AXOLOTL ratchet advance. |
@@ -335,7 +336,7 @@ shutdown_task (void *cls) | |||
335 | } | 336 | } |
336 | if (NULL != connections) | 337 | if (NULL != connections) |
337 | { | 338 | { |
338 | GNUNET_CONTAINER_multihashmap_destroy (connections); | 339 | GNUNET_CONTAINER_multishortmap_destroy (connections); |
339 | connections = NULL; | 340 | connections = NULL; |
340 | } | 341 | } |
341 | if (NULL != ats_ch) | 342 | if (NULL != ats_ch) |
@@ -909,7 +910,7 @@ iter_channel (void *cls, | |||
909 | struct CadetChannel *ch) | 910 | struct CadetChannel *ch) |
910 | { | 911 | { |
911 | struct GNUNET_CADET_LocalInfoTunnel *msg = cls; | 912 | struct GNUNET_CADET_LocalInfoTunnel *msg = cls; |
912 | struct GNUNET_CADET_Hash *h = (struct GNUNET_CADET_Hash *) &msg[1]; | 913 | struct GNUNET_CADET_ConnectionTunnelIdentifier *h = (struct GNUNET_CADET_ConnectionTunnelIdentifier *) &msg[1]; |
913 | struct GCT_ChannelTunnelNumber *chn | 914 | struct GCT_ChannelTunnelNumber *chn |
914 | = (struct GCT_ChannelTunnelNumber *) &h[msg->connections]; | 915 | = (struct GCT_ChannelTunnelNumber *) &h[msg->connections]; |
915 | 916 | ||
@@ -961,7 +962,7 @@ handle_show_tunnel (void *cls, | |||
961 | ch_n = GCT_count_channels (t); | 962 | ch_n = GCT_count_channels (t); |
962 | c_n = GCT_count_any_connections (t); | 963 | c_n = GCT_count_any_connections (t); |
963 | env = GNUNET_MQ_msg_extra (resp, | 964 | env = GNUNET_MQ_msg_extra (resp, |
964 | c_n * sizeof (struct GNUNET_CADET_Hash) + | 965 | c_n * sizeof (struct GNUNET_CADET_ConnectionTunnelIdentifier) + |
965 | ch_n * sizeof (struct GCT_ChannelTunnelNumber), | 966 | ch_n * sizeof (struct GCT_ChannelTunnelNumber), |
966 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL); | 967 | GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_TUNNEL); |
967 | resp->destination = msg->peer; | 968 | resp->destination = msg->peer; |
@@ -1278,8 +1279,8 @@ run (void *cls, | |||
1278 | GNUNET_NO); | 1279 | GNUNET_NO); |
1279 | peers = GNUNET_CONTAINER_multipeermap_create (16, | 1280 | peers = GNUNET_CONTAINER_multipeermap_create (16, |
1280 | GNUNET_YES); | 1281 | GNUNET_YES); |
1281 | connections = GNUNET_CONTAINER_multihashmap_create (256, | 1282 | connections = GNUNET_CONTAINER_multishortmap_create (256, |
1282 | GNUNET_YES); | 1283 | GNUNET_YES); |
1283 | GCH_init (c); | 1284 | GCH_init (c); |
1284 | GCD_init (c); | 1285 | GCD_init (c); |
1285 | GCO_init (c); | 1286 | GCO_init (c); |