diff options
author | t3sserakt <t3ss@posteo.de> | 2019-06-25 18:06:44 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2019-06-25 18:06:44 +0200 |
commit | f606540bcb19245aabd2f645cd9567260659ee4c (patch) | |
tree | 2d13fe5bfcf6ba7a4971d3bfa7082e3d529de654 /src/cadet | |
parent | 28d3e0676f262e495c6d5c49bbedd5ce65502cee (diff) | |
download | gnunet-f606540bcb19245aabd2f645cd9567260659ee4c.tar.gz gnunet-f606540bcb19245aabd2f645cd9567260659ee4c.zip |
added per message GNUNET_MQ_PriorityPreferences
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/gnunet-service-cadet_core.c | 39 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnels.c | 3 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/cadet/gnunet-service-cadet_core.c b/src/cadet/gnunet-service-cadet_core.c index c5d2f195a..220a2b3cd 100644 --- a/src/cadet/gnunet-service-cadet_core.c +++ b/src/cadet/gnunet-service-cadet_core.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include "gnunet_statistics_service.h" | 39 | #include "gnunet_statistics_service.h" |
40 | #include "cadet_protocol.h" | 40 | #include "cadet_protocol.h" |
41 | 41 | ||
42 | |||
43 | #define LOG(level, ...) GNUNET_log_from(level,"cadet-cor",__VA_ARGS__) | 42 | #define LOG(level, ...) GNUNET_log_from(level,"cadet-cor",__VA_ARGS__) |
44 | 43 | ||
45 | /** | 44 | /** |
@@ -47,7 +46,6 @@ | |||
47 | */ | 46 | */ |
48 | struct RouteDirection; | 47 | struct RouteDirection; |
49 | 48 | ||
50 | |||
51 | /** | 49 | /** |
52 | * Set of CadetRoutes that have exactly the same number of messages | 50 | * Set of CadetRoutes that have exactly the same number of messages |
53 | * in their buffer. Used so we can efficiently find all of those | 51 | * in their buffer. Used so we can efficiently find all of those |
@@ -346,7 +344,8 @@ discard_all_from_rung_tail () | |||
346 | static void | 344 | static void |
347 | route_message (struct CadetPeer *prev, | 345 | route_message (struct CadetPeer *prev, |
348 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, | 346 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, |
349 | const struct GNUNET_MessageHeader *msg) | 347 | const struct GNUNET_MessageHeader *msg, |
348 | const enum GNUNET_MQ_PriorityPreferences priority) | ||
350 | { | 349 | { |
351 | struct CadetRoute *route; | 350 | struct CadetRoute *route; |
352 | struct RouteDirection *dir; | 351 | struct RouteDirection *dir; |
@@ -399,7 +398,7 @@ route_message (struct CadetPeer *prev, | |||
399 | } | 398 | } |
400 | /* Check if buffering is disallowed, and if so, make sure we only queue | 399 | /* Check if buffering is disallowed, and if so, make sure we only queue |
401 | one message per direction. */ | 400 | one message per direction. */ |
402 | if ( (0 != (route->options & GNUNET_CADET_OPTION_NOBUFFER)) && | 401 | if ( (0 != (priority & GNUNET_MQ_PREF_NO_BUFFER)) && |
403 | (NULL != dir->env_head) ) | 402 | (NULL != dir->env_head) ) |
404 | discard_buffer (dir, | 403 | discard_buffer (dir, |
405 | dir->env_head); | 404 | dir->env_head); |
@@ -793,9 +792,7 @@ handle_connection_create (void *cls, | |||
793 | uint16_t size = ntohs (msg->header.size) - sizeof (*msg); | 792 | uint16_t size = ntohs (msg->header.size) - sizeof (*msg); |
794 | unsigned int path_length; | 793 | unsigned int path_length; |
795 | unsigned int off; | 794 | unsigned int off; |
796 | enum GNUNET_CADET_ChannelOption options; | ||
797 | 795 | ||
798 | options = (enum GNUNET_CADET_ChannelOption) ntohl (msg->options); | ||
799 | path_length = size / sizeof (struct GNUNET_PeerIdentity); | 796 | path_length = size / sizeof (struct GNUNET_PeerIdentity); |
800 | if (0 == path_length) | 797 | if (0 == path_length) |
801 | { | 798 | { |
@@ -869,7 +866,8 @@ handle_connection_create (void *cls, | |||
869 | GNUNET_sh2s (&msg->cid.connection_of_tunnel)); | 866 | GNUNET_sh2s (&msg->cid.connection_of_tunnel)); |
870 | route_message (sender, | 867 | route_message (sender, |
871 | &msg->cid, | 868 | &msg->cid, |
872 | &msg->header); | 869 | &msg->header, |
870 | GNUNET_MQ_PRIO_CRITICAL_CONTROL); | ||
873 | return; | 871 | return; |
874 | } | 872 | } |
875 | if (off == path_length - 1) | 873 | if (off == path_length - 1) |
@@ -901,7 +899,6 @@ handle_connection_create (void *cls, | |||
901 | GCT_add_inbound_connection (GCP_get_tunnel (origin, | 899 | GCT_add_inbound_connection (GCP_get_tunnel (origin, |
902 | GNUNET_YES), | 900 | GNUNET_YES), |
903 | &msg->cid, | 901 | &msg->cid, |
904 | (enum GNUNET_CADET_ChannelOption) ntohl (msg->options), | ||
905 | path)) | 902 | path)) |
906 | { | 903 | { |
907 | /* Send back BROKEN: duplicate connection on the same path, | 904 | /* Send back BROKEN: duplicate connection on the same path, |
@@ -956,7 +953,6 @@ handle_connection_create (void *cls, | |||
956 | GNUNET_i2s (&pids[off + 1]), | 953 | GNUNET_i2s (&pids[off + 1]), |
957 | off + 1); | 954 | off + 1); |
958 | route = GNUNET_new (struct CadetRoute); | 955 | route = GNUNET_new (struct CadetRoute); |
959 | route->options = options; | ||
960 | route->cid = msg->cid; | 956 | route->cid = msg->cid; |
961 | route->last_use = GNUNET_TIME_absolute_get (); | 957 | route->last_use = GNUNET_TIME_absolute_get (); |
962 | dir_init (&route->prev, | 958 | dir_init (&route->prev, |
@@ -985,7 +981,8 @@ handle_connection_create (void *cls, | |||
985 | /* also pass CREATE message along to next hop */ | 981 | /* also pass CREATE message along to next hop */ |
986 | route_message (sender, | 982 | route_message (sender, |
987 | &msg->cid, | 983 | &msg->cid, |
988 | &msg->header); | 984 | &msg->header, |
985 | GNUNET_MQ_PRIO_CRITICAL_CONTROL); | ||
989 | } | 986 | } |
990 | 987 | ||
991 | 988 | ||
@@ -1029,7 +1026,8 @@ handle_connection_create_ack (void *cls, | |||
1029 | /* We're just an intermediary peer, route the message along its path */ | 1026 | /* We're just an intermediary peer, route the message along its path */ |
1030 | route_message (peer, | 1027 | route_message (peer, |
1031 | &msg->cid, | 1028 | &msg->cid, |
1032 | &msg->header); | 1029 | &msg->header, |
1030 | GNUNET_MQ_PRIO_CRITICAL_CONTROL); | ||
1033 | } | 1031 | } |
1034 | 1032 | ||
1035 | 1033 | ||
@@ -1077,7 +1075,8 @@ handle_connection_broken (void *cls, | |||
1077 | /* We're just an intermediary peer, route the message along its path */ | 1075 | /* We're just an intermediary peer, route the message along its path */ |
1078 | route_message (peer, | 1076 | route_message (peer, |
1079 | &msg->cid, | 1077 | &msg->cid, |
1080 | &msg->header); | 1078 | &msg->header, |
1079 | GNUNET_MQ_PREF_NO_BUFFER); | ||
1081 | route = get_route (&msg->cid); | 1080 | route = get_route (&msg->cid); |
1082 | if (NULL != route) | 1081 | if (NULL != route) |
1083 | destroy_route (route); | 1082 | destroy_route (route); |
@@ -1130,7 +1129,8 @@ handle_connection_destroy (void *cls, | |||
1130 | GNUNET_sh2s (&msg->cid.connection_of_tunnel)); | 1129 | GNUNET_sh2s (&msg->cid.connection_of_tunnel)); |
1131 | route_message (peer, | 1130 | route_message (peer, |
1132 | &msg->cid, | 1131 | &msg->cid, |
1133 | &msg->header); | 1132 | &msg->header, |
1133 | GNUNET_MQ_PREF_NO_BUFFER); | ||
1134 | route = get_route (&msg->cid); | 1134 | route = get_route (&msg->cid); |
1135 | if (NULL != route) | 1135 | if (NULL != route) |
1136 | destroy_route (route); | 1136 | destroy_route (route); |
@@ -1181,7 +1181,8 @@ handle_tunnel_kx (void *cls, | |||
1181 | /* We're just an intermediary peer, route the message along its path */ | 1181 | /* We're just an intermediary peer, route the message along its path */ |
1182 | route_message (peer, | 1182 | route_message (peer, |
1183 | &msg->cid, | 1183 | &msg->cid, |
1184 | &msg->header); | 1184 | &msg->header, |
1185 | GNUNET_MQ_PRIO_CRITICAL_CONTROL); | ||
1185 | } | 1186 | } |
1186 | 1187 | ||
1187 | 1188 | ||
@@ -1223,7 +1224,8 @@ handle_tunnel_kx_auth (void *cls, | |||
1223 | /* We're just an intermediary peer, route the message along its path */ | 1224 | /* We're just an intermediary peer, route the message along its path */ |
1224 | route_message (peer, | 1225 | route_message (peer, |
1225 | &msg->kx.cid, | 1226 | &msg->kx.cid, |
1226 | &msg->kx.header); | 1227 | &msg->kx.header, |
1228 | GNUNET_MQ_PRIO_CRITICAL_CONTROL); | ||
1227 | } | 1229 | } |
1228 | 1230 | ||
1229 | 1231 | ||
@@ -1280,7 +1282,8 @@ handle_tunnel_encrypted (void *cls, | |||
1280 | /* We're just an intermediary peer, route the message along its path */ | 1282 | /* We're just an intermediary peer, route the message along its path */ |
1281 | route_message (peer, | 1283 | route_message (peer, |
1282 | &msg->cid, | 1284 | &msg->cid, |
1283 | &msg->header); | 1285 | &msg->header, |
1286 | GNUNET_MQ_PRIO_CRITICAL_CONTROL); | ||
1284 | } | 1287 | } |
1285 | 1288 | ||
1286 | 1289 | ||
@@ -1401,13 +1404,13 @@ GCO_init (const struct GNUNET_CONFIGURATION_Handle *c) | |||
1401 | "CADET", | 1404 | "CADET", |
1402 | "MAX_ROUTES", | 1405 | "MAX_ROUTES", |
1403 | &max_routes)) | 1406 | &max_routes)) |
1404 | max_routes = 5000; | 1407 | max_routes = 5000; |
1405 | if (GNUNET_OK != | 1408 | if (GNUNET_OK != |
1406 | GNUNET_CONFIGURATION_get_value_number (c, | 1409 | GNUNET_CONFIGURATION_get_value_number (c, |
1407 | "CADET", | 1410 | "CADET", |
1408 | "MAX_MSGS_QUEUE", | 1411 | "MAX_MSGS_QUEUE", |
1409 | &max_buffers)) | 1412 | &max_buffers)) |
1410 | max_buffers = 10000; | 1413 | max_buffers = 10000; |
1411 | routes = GNUNET_CONTAINER_multishortmap_create (1024, | 1414 | routes = GNUNET_CONTAINER_multishortmap_create (1024, |
1412 | GNUNET_NO); | 1415 | GNUNET_NO); |
1413 | route_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 1416 | route_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); |
diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c index a2a493ebd..11be2bce0 100644 --- a/src/cadet/gnunet-service-cadet_tunnels.c +++ b/src/cadet/gnunet-service-cadet_tunnels.c | |||
@@ -2731,7 +2731,6 @@ consider_path_cb (void *cls, | |||
2731 | ct->cc = GCC_create (t->destination, | 2731 | ct->cc = GCC_create (t->destination, |
2732 | path, | 2732 | path, |
2733 | off, | 2733 | off, |
2734 | GNUNET_CADET_OPTION_DEFAULT, /* FIXME: set based on what channels want/need! */ | ||
2735 | ct, | 2734 | ct, |
2736 | &connection_ready_cb, | 2735 | &connection_ready_cb, |
2737 | ct); | 2736 | ct); |
@@ -3204,7 +3203,6 @@ GCT_create_tunnel (struct CadetPeer *destination) | |||
3204 | int | 3203 | int |
3205 | GCT_add_inbound_connection (struct CadetTunnel *t, | 3204 | GCT_add_inbound_connection (struct CadetTunnel *t, |
3206 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, | 3205 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cid, |
3207 | enum GNUNET_CADET_ChannelOption options, | ||
3208 | struct CadetPeerPath *path) | 3206 | struct CadetPeerPath *path) |
3209 | { | 3207 | { |
3210 | struct CadetTConnection *ct; | 3208 | struct CadetTConnection *ct; |
@@ -3214,7 +3212,6 @@ GCT_add_inbound_connection (struct CadetTunnel *t, | |||
3214 | ct->t = t; | 3212 | ct->t = t; |
3215 | ct->cc = GCC_create_inbound (t->destination, | 3213 | ct->cc = GCC_create_inbound (t->destination, |
3216 | path, | 3214 | path, |
3217 | options, | ||
3218 | ct, | 3215 | ct, |
3219 | cid, | 3216 | cid, |
3220 | &connection_ready_cb, | 3217 | &connection_ready_cb, |