diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-11-05 18:21:50 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-11-05 18:21:50 +0000 |
commit | 75a33a1499cf60ea4364c9aa673816629a6c1413 (patch) | |
tree | 0620da4312bb04de4d7b65074fdd3b0c3dd6cc0e /src/transport | |
parent | 7217c601ad30760872823193d62307e7a335d226 (diff) | |
download | gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.tar.gz gnunet-75a33a1499cf60ea4364c9aa673816629a6c1413.zip |
big scheduler refactoring, expect some issues
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 90 | ||||
-rw-r--r-- | src/transport/plugin_transport.h | 5 | ||||
-rw-r--r-- | src/transport/plugin_transport_http.c | 41 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 37 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 42 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 14 | ||||
-rw-r--r-- | src/transport/test_plugin_transport.c | 12 | ||||
-rw-r--r-- | src/transport/test_plugin_transport_http.c | 22 | ||||
-rw-r--r-- | src/transport/test_plugin_transport_https.c | 22 | ||||
-rw-r--r-- | src/transport/test_plugin_transport_udp.c | 9 | ||||
-rw-r--r-- | src/transport/test_quota_compliance.c | 41 | ||||
-rw-r--r-- | src/transport/test_transport_api.c | 16 | ||||
-rw-r--r-- | src/transport/test_transport_api_reliability.c | 28 | ||||
-rw-r--r-- | src/transport/transport_api.c | 52 | ||||
-rw-r--r-- | src/transport/transport_api_address_lookup.c | 6 | ||||
-rw-r--r-- | src/transport/transport_api_blacklist.c | 15 |
16 files changed, 151 insertions, 301 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 87d73baf4..0ade42512 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -843,11 +843,6 @@ static struct GNUNET_PeerIdentity my_identity; | |||
843 | static struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key; | 843 | static struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key; |
844 | 844 | ||
845 | /** | 845 | /** |
846 | * Our scheduler. | ||
847 | */ | ||
848 | struct GNUNET_SCHEDULER_Handle *sched; | ||
849 | |||
850 | /** | ||
851 | * Our configuration. | 846 | * Our configuration. |
852 | */ | 847 | */ |
853 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 848 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -1656,10 +1651,8 @@ try_transmission_to_peer (struct NeighbourList *neighbour) | |||
1656 | 1, | 1651 | 1, |
1657 | GNUNET_NO); | 1652 | GNUNET_NO); |
1658 | if (neighbour->retry_task != GNUNET_SCHEDULER_NO_TASK) | 1653 | if (neighbour->retry_task != GNUNET_SCHEDULER_NO_TASK) |
1659 | GNUNET_SCHEDULER_cancel (sched, | 1654 | GNUNET_SCHEDULER_cancel (neighbour->retry_task); |
1660 | neighbour->retry_task); | 1655 | neighbour->retry_task = GNUNET_SCHEDULER_add_delayed (timeout, |
1661 | neighbour->retry_task = GNUNET_SCHEDULER_add_delayed (sched, | ||
1662 | timeout, | ||
1663 | &retry_transmission_task, | 1656 | &retry_transmission_task, |
1664 | neighbour); | 1657 | neighbour); |
1665 | #if DEBUG_TRANSPORT | 1658 | #if DEBUG_TRANSPORT |
@@ -1924,7 +1917,7 @@ update_addresses (struct TransportPlugin *plugin, int fresh) | |||
1924 | int expired; | 1917 | int expired; |
1925 | 1918 | ||
1926 | if (plugin->address_update_task != GNUNET_SCHEDULER_NO_TASK) | 1919 | if (plugin->address_update_task != GNUNET_SCHEDULER_NO_TASK) |
1927 | GNUNET_SCHEDULER_cancel (plugin->env.sched, plugin->address_update_task); | 1920 | GNUNET_SCHEDULER_cancel (plugin->address_update_task); |
1928 | plugin->address_update_task = GNUNET_SCHEDULER_NO_TASK; | 1921 | plugin->address_update_task = GNUNET_SCHEDULER_NO_TASK; |
1929 | now = GNUNET_TIME_absolute_get (); | 1922 | now = GNUNET_TIME_absolute_get (); |
1930 | min_remaining = GNUNET_TIME_UNIT_FOREVER_REL; | 1923 | min_remaining = GNUNET_TIME_UNIT_FOREVER_REL; |
@@ -1962,8 +1955,7 @@ update_addresses (struct TransportPlugin *plugin, int fresh) | |||
1962 | GNUNET_TIME_relative_divide (HELLO_ADDRESS_EXPIRATION, | 1955 | GNUNET_TIME_relative_divide (HELLO_ADDRESS_EXPIRATION, |
1963 | 2)); | 1956 | 2)); |
1964 | plugin->address_update_task | 1957 | plugin->address_update_task |
1965 | = GNUNET_SCHEDULER_add_delayed (plugin->env.sched, | 1958 | = GNUNET_SCHEDULER_add_delayed (min_remaining, |
1966 | min_remaining, | ||
1967 | &expire_address_task, plugin); | 1959 | &expire_address_task, plugin); |
1968 | } | 1960 | } |
1969 | 1961 | ||
@@ -2126,8 +2118,7 @@ plugin_env_session_end (void *cls, | |||
2126 | prev->next = pos->next; | 2118 | prev->next = pos->next; |
2127 | if (GNUNET_SCHEDULER_NO_TASK != pos->revalidate_task) | 2119 | if (GNUNET_SCHEDULER_NO_TASK != pos->revalidate_task) |
2128 | { | 2120 | { |
2129 | GNUNET_SCHEDULER_cancel (sched, | 2121 | GNUNET_SCHEDULER_cancel (pos->revalidate_task); |
2130 | pos->revalidate_task); | ||
2131 | pos->revalidate_task = GNUNET_SCHEDULER_NO_TASK; | 2122 | pos->revalidate_task = GNUNET_SCHEDULER_NO_TASK; |
2132 | } | 2123 | } |
2133 | GNUNET_free (pos); | 2124 | GNUNET_free (pos); |
@@ -2518,7 +2509,7 @@ abort_validation (void *cls, | |||
2518 | struct ValidationEntry *va = value; | 2509 | struct ValidationEntry *va = value; |
2519 | 2510 | ||
2520 | if (GNUNET_SCHEDULER_NO_TASK != va->timeout_task) | 2511 | if (GNUNET_SCHEDULER_NO_TASK != va->timeout_task) |
2521 | GNUNET_SCHEDULER_cancel (sched, va->timeout_task); | 2512 | GNUNET_SCHEDULER_cancel (va->timeout_task); |
2522 | GNUNET_free (va->transport_name); | 2513 | GNUNET_free (va->transport_name); |
2523 | if (va->chvc != NULL) | 2514 | if (va->chvc != NULL) |
2524 | { | 2515 | { |
@@ -2776,8 +2767,7 @@ setup_new_neighbour (const struct GNUNET_PeerIdentity *peer, | |||
2776 | } | 2767 | } |
2777 | n->latency = GNUNET_TIME_UNIT_FOREVER_REL; | 2768 | n->latency = GNUNET_TIME_UNIT_FOREVER_REL; |
2778 | n->distance = -1; | 2769 | n->distance = -1; |
2779 | n->timeout_task = GNUNET_SCHEDULER_add_delayed (sched, | 2770 | n->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, |
2780 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
2781 | &neighbour_timeout_task, n); | 2771 | &neighbour_timeout_task, n); |
2782 | if (do_hello) | 2772 | if (do_hello) |
2783 | { | 2773 | { |
@@ -2954,8 +2944,7 @@ transmit_blacklist_message (void *cls, | |||
2954 | if (size == 0) | 2944 | if (size == 0) |
2955 | { | 2945 | { |
2956 | GNUNET_assert (bc->task == GNUNET_SCHEDULER_NO_TASK); | 2946 | GNUNET_assert (bc->task == GNUNET_SCHEDULER_NO_TASK); |
2957 | bc->task = GNUNET_SCHEDULER_add_now (sched, | 2947 | bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, |
2958 | &do_blacklist_check, | ||
2959 | bc); | 2948 | bc); |
2960 | return 0; | 2949 | return 0; |
2961 | } | 2950 | } |
@@ -3047,8 +3036,7 @@ setup_peer_check_blacklist (const struct GNUNET_PeerIdentity *peer, | |||
3047 | bc->cont = cont; | 3036 | bc->cont = cont; |
3048 | bc->cont_cls = cont_cls; | 3037 | bc->cont_cls = cont_cls; |
3049 | bc->bl_pos = bl_head; | 3038 | bc->bl_pos = bl_head; |
3050 | bc->task = GNUNET_SCHEDULER_add_now (sched, | 3039 | bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, |
3051 | &do_blacklist_check, | ||
3052 | bc); | 3040 | bc); |
3053 | } | 3041 | } |
3054 | 3042 | ||
@@ -3120,8 +3108,7 @@ handle_blacklist_init (void *cls, | |||
3120 | bc->bl_pos = bl; | 3108 | bc->bl_pos = bl; |
3121 | if (n == neighbours) /* all would wait for the same client, no need to | 3109 | if (n == neighbours) /* all would wait for the same client, no need to |
3122 | create more than just the first task right now */ | 3110 | create more than just the first task right now */ |
3123 | bc->task = GNUNET_SCHEDULER_add_now (sched, | 3111 | bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, |
3124 | &do_blacklist_check, | ||
3125 | bc); | 3112 | bc); |
3126 | n = n->next; | 3113 | n = n->next; |
3127 | } | 3114 | } |
@@ -3164,8 +3151,7 @@ handle_blacklist_reply (void *cls, | |||
3164 | else | 3151 | else |
3165 | { | 3152 | { |
3166 | bc->bl_pos = bc->bl_pos->next; | 3153 | bc->bl_pos = bc->bl_pos->next; |
3167 | bc->task = GNUNET_SCHEDULER_add_now (sched, | 3154 | bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, |
3168 | &do_blacklist_check, | ||
3169 | bc); | 3155 | bc); |
3170 | } | 3156 | } |
3171 | /* check if any other bc's are waiting for this blacklister */ | 3157 | /* check if any other bc's are waiting for this blacklister */ |
@@ -3174,8 +3160,7 @@ handle_blacklist_reply (void *cls, | |||
3174 | { | 3160 | { |
3175 | if ( (bc->bl_pos == bl) && | 3161 | if ( (bc->bl_pos == bl) && |
3176 | (GNUNET_SCHEDULER_NO_TASK == bc->task) ) | 3162 | (GNUNET_SCHEDULER_NO_TASK == bc->task) ) |
3177 | bc->task = GNUNET_SCHEDULER_add_now (sched, | 3163 | bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, |
3178 | &do_blacklist_check, | ||
3179 | bc); | 3164 | bc); |
3180 | bc = bc->next; | 3165 | bc = bc->next; |
3181 | } | 3166 | } |
@@ -3258,8 +3243,7 @@ send_periodic_ping (void *cls, | |||
3258 | &neighbour->publicKey, | 3243 | &neighbour->publicKey, |
3259 | sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); | 3244 | sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); |
3260 | 3245 | ||
3261 | va->timeout_task = GNUNET_SCHEDULER_add_delayed (sched, | 3246 | va->timeout_task = GNUNET_SCHEDULER_add_delayed (HELLO_VERIFICATION_TIMEOUT, |
3262 | HELLO_VERIFICATION_TIMEOUT, | ||
3263 | &timeout_hello_validation, | 3247 | &timeout_hello_validation, |
3264 | va); | 3248 | va); |
3265 | GNUNET_CONTAINER_multihashmap_put (validation_map, | 3249 | GNUNET_CONTAINER_multihashmap_put (validation_map, |
@@ -3384,8 +3368,7 @@ schedule_next_ping (struct ForeignAddressList *fal) | |||
3384 | GNUNET_TIME_UNIT_SECONDS); | 3368 | GNUNET_TIME_UNIT_SECONDS); |
3385 | /* randomize a bit (to avoid doing all at the same time) */ | 3369 | /* randomize a bit (to avoid doing all at the same time) */ |
3386 | delay.rel_value += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000); | 3370 | delay.rel_value += GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000); |
3387 | fal->revalidate_task = GNUNET_SCHEDULER_add_delayed(sched, | 3371 | fal->revalidate_task = GNUNET_SCHEDULER_add_delayed(delay, |
3388 | delay, | ||
3389 | &send_periodic_ping, | 3372 | &send_periodic_ping, |
3390 | fal); | 3373 | fal); |
3391 | } | 3374 | } |
@@ -3691,8 +3674,7 @@ check_pending_validation (void *cls, | |||
3691 | } | 3674 | } |
3692 | if (n->retry_task != GNUNET_SCHEDULER_NO_TASK) | 3675 | if (n->retry_task != GNUNET_SCHEDULER_NO_TASK) |
3693 | { | 3676 | { |
3694 | GNUNET_SCHEDULER_cancel (sched, | 3677 | GNUNET_SCHEDULER_cancel (n->retry_task); |
3695 | n->retry_task); | ||
3696 | n->retry_task = GNUNET_SCHEDULER_NO_TASK; | 3678 | n->retry_task = GNUNET_SCHEDULER_NO_TASK; |
3697 | try_transmission_to_peer (n); | 3679 | try_transmission_to_peer (n); |
3698 | } | 3680 | } |
@@ -3981,8 +3963,7 @@ run_validation (void *cls, | |||
3981 | va->addrlen = addrlen; | 3963 | va->addrlen = addrlen; |
3982 | GNUNET_HELLO_get_key (chvc->hello, | 3964 | GNUNET_HELLO_get_key (chvc->hello, |
3983 | &va->publicKey); | 3965 | &va->publicKey); |
3984 | va->timeout_task = GNUNET_SCHEDULER_add_delayed (sched, | 3966 | va->timeout_task = GNUNET_SCHEDULER_add_delayed (HELLO_VERIFICATION_TIMEOUT, |
3985 | HELLO_VERIFICATION_TIMEOUT, | ||
3986 | &timeout_hello_validation, | 3967 | &timeout_hello_validation, |
3987 | va); | 3968 | va); |
3988 | GNUNET_CONTAINER_multihashmap_put (validation_map, | 3969 | GNUNET_CONTAINER_multihashmap_put (validation_map, |
@@ -4146,8 +4127,7 @@ process_hello (struct TransportPlugin *plugin, | |||
4146 | GNUNET_NO); | 4127 | GNUNET_NO); |
4147 | 4128 | ||
4148 | /* first, check if load is too high */ | 4129 | /* first, check if load is too high */ |
4149 | if (GNUNET_SCHEDULER_get_load (sched, | 4130 | if (GNUNET_SCHEDULER_get_load (GNUNET_SCHEDULER_PRIORITY_BACKGROUND) > MAX_HELLO_LOAD) |
4150 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND) > MAX_HELLO_LOAD) | ||
4151 | { | 4131 | { |
4152 | GNUNET_STATISTICS_update (stats, | 4132 | GNUNET_STATISTICS_update (stats, |
4153 | gettext_noop ("# HELLOs ignored due to high load"), | 4133 | gettext_noop ("# HELLOs ignored due to high load"), |
@@ -4351,8 +4331,7 @@ disconnect_neighbour (struct NeighbourList *n, int check) | |||
4351 | GNUNET_NO); | 4331 | GNUNET_NO); |
4352 | if (GNUNET_SCHEDULER_NO_TASK != peer_pos->revalidate_task) | 4332 | if (GNUNET_SCHEDULER_NO_TASK != peer_pos->revalidate_task) |
4353 | { | 4333 | { |
4354 | GNUNET_SCHEDULER_cancel (sched, | 4334 | GNUNET_SCHEDULER_cancel (peer_pos->revalidate_task); |
4355 | peer_pos->revalidate_task); | ||
4356 | peer_pos->revalidate_task = GNUNET_SCHEDULER_NO_TASK; | 4335 | peer_pos->revalidate_task = GNUNET_SCHEDULER_NO_TASK; |
4357 | } | 4336 | } |
4358 | GNUNET_free(peer_pos); | 4337 | GNUNET_free(peer_pos); |
@@ -4381,12 +4360,12 @@ disconnect_neighbour (struct NeighbourList *n, int check) | |||
4381 | } | 4360 | } |
4382 | if (n->timeout_task != GNUNET_SCHEDULER_NO_TASK) | 4361 | if (n->timeout_task != GNUNET_SCHEDULER_NO_TASK) |
4383 | { | 4362 | { |
4384 | GNUNET_SCHEDULER_cancel (sched, n->timeout_task); | 4363 | GNUNET_SCHEDULER_cancel (n->timeout_task); |
4385 | n->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 4364 | n->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
4386 | } | 4365 | } |
4387 | if (n->retry_task != GNUNET_SCHEDULER_NO_TASK) | 4366 | if (n->retry_task != GNUNET_SCHEDULER_NO_TASK) |
4388 | { | 4367 | { |
4389 | GNUNET_SCHEDULER_cancel (sched, n->retry_task); | 4368 | GNUNET_SCHEDULER_cancel (n->retry_task); |
4390 | n->retry_task = GNUNET_SCHEDULER_NO_TASK; | 4369 | n->retry_task = GNUNET_SCHEDULER_NO_TASK; |
4391 | } | 4370 | } |
4392 | if (n->piter != NULL) | 4371 | if (n->piter != NULL) |
@@ -4736,11 +4715,9 @@ plugin_env_receive (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
4736 | n->peer_timeout = | 4715 | n->peer_timeout = |
4737 | GNUNET_TIME_relative_to_absolute | 4716 | GNUNET_TIME_relative_to_absolute |
4738 | (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | 4717 | (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); |
4739 | GNUNET_SCHEDULER_cancel (sched, | 4718 | GNUNET_SCHEDULER_cancel (n->timeout_task); |
4740 | n->timeout_task); | ||
4741 | n->timeout_task = | 4719 | n->timeout_task = |
4742 | GNUNET_SCHEDULER_add_delayed (sched, | 4720 | GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, |
4743 | GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
4744 | &neighbour_timeout_task, n); | 4721 | &neighbour_timeout_task, n); |
4745 | if (n->quota_violation_count > QUOTA_VIOLATION_DROP_THRESHOLD) | 4722 | if (n->quota_violation_count > QUOTA_VIOLATION_DROP_THRESHOLD) |
4746 | { | 4723 | { |
@@ -5191,7 +5168,6 @@ static void | |||
5191 | create_environment (struct TransportPlugin *plug) | 5168 | create_environment (struct TransportPlugin *plug) |
5192 | { | 5169 | { |
5193 | plug->env.cfg = cfg; | 5170 | plug->env.cfg = cfg; |
5194 | plug->env.sched = sched; | ||
5195 | plug->env.my_identity = &my_identity; | 5171 | plug->env.my_identity = &my_identity; |
5196 | plug->env.our_hello = &our_hello; | 5172 | plug->env.our_hello = &our_hello; |
5197 | plug->env.cls = plug; | 5173 | plug->env.cls = plug; |
@@ -5276,8 +5252,7 @@ client_disconnect_notification (void *cls, | |||
5276 | bc->th = NULL; | 5252 | bc->th = NULL; |
5277 | } | 5253 | } |
5278 | if (bc->task == GNUNET_SCHEDULER_NO_TASK) | 5254 | if (bc->task == GNUNET_SCHEDULER_NO_TASK) |
5279 | bc->task = GNUNET_SCHEDULER_add_now (sched, | 5255 | bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, |
5280 | &do_blacklist_check, | ||
5281 | bc); | 5256 | bc); |
5282 | break; | 5257 | break; |
5283 | } | 5258 | } |
@@ -5359,8 +5334,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
5359 | plugins = plug->next; | 5334 | plugins = plug->next; |
5360 | if (plug->address_update_task != GNUNET_SCHEDULER_NO_TASK) | 5335 | if (plug->address_update_task != GNUNET_SCHEDULER_NO_TASK) |
5361 | { | 5336 | { |
5362 | GNUNET_SCHEDULER_cancel (plug->env.sched, | 5337 | GNUNET_SCHEDULER_cancel (plug->address_update_task); |
5363 | plug->address_update_task); | ||
5364 | plug->address_update_task = GNUNET_SCHEDULER_NO_TASK; | 5338 | plug->address_update_task = GNUNET_SCHEDULER_NO_TASK; |
5365 | } | 5339 | } |
5366 | GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api)); | 5340 | GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api)); |
@@ -5423,13 +5397,11 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
5423 | * Initiate transport service. | 5397 | * Initiate transport service. |
5424 | * | 5398 | * |
5425 | * @param cls closure | 5399 | * @param cls closure |
5426 | * @param s scheduler to use | ||
5427 | * @param server the initialized server | 5400 | * @param server the initialized server |
5428 | * @param c configuration to use | 5401 | * @param c configuration to use |
5429 | */ | 5402 | */ |
5430 | static void | 5403 | static void |
5431 | run (void *cls, | 5404 | run (void *cls, |
5432 | struct GNUNET_SCHEDULER_Handle *s, | ||
5433 | struct GNUNET_SERVER_Handle *server, | 5405 | struct GNUNET_SERVER_Handle *server, |
5434 | const struct GNUNET_CONFIGURATION_Handle *c) | 5406 | const struct GNUNET_CONFIGURATION_Handle *c) |
5435 | { | 5407 | { |
@@ -5459,9 +5431,8 @@ run (void *cls, | |||
5459 | unsigned long long tneigh; | 5431 | unsigned long long tneigh; |
5460 | char *keyfile; | 5432 | char *keyfile; |
5461 | 5433 | ||
5462 | sched = s; | ||
5463 | cfg = c; | 5434 | cfg = c; |
5464 | stats = GNUNET_STATISTICS_create (sched, "transport", cfg); | 5435 | stats = GNUNET_STATISTICS_create ("transport", cfg); |
5465 | validation_map = GNUNET_CONTAINER_multihashmap_create (64); | 5436 | validation_map = GNUNET_CONTAINER_multihashmap_create (64); |
5466 | /* parse configuration */ | 5437 | /* parse configuration */ |
5467 | if ((GNUNET_OK != | 5438 | if ((GNUNET_OK != |
@@ -5477,7 +5448,7 @@ run (void *cls, | |||
5477 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 5448 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
5478 | _ | 5449 | _ |
5479 | ("Transport service is lacking key configuration settings. Exiting.\n")); | 5450 | ("Transport service is lacking key configuration settings. Exiting.\n")); |
5480 | GNUNET_SCHEDULER_shutdown (s); | 5451 | GNUNET_SCHEDULER_shutdown (); |
5481 | if (stats != NULL) | 5452 | if (stats != NULL) |
5482 | { | 5453 | { |
5483 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); | 5454 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); |
@@ -5488,12 +5459,12 @@ run (void *cls, | |||
5488 | return; | 5459 | return; |
5489 | } | 5460 | } |
5490 | max_connect_per_transport = (uint32_t) tneigh; | 5461 | max_connect_per_transport = (uint32_t) tneigh; |
5491 | peerinfo = GNUNET_PEERINFO_connect (sched, cfg); | 5462 | peerinfo = GNUNET_PEERINFO_connect (cfg); |
5492 | if (peerinfo == NULL) | 5463 | if (peerinfo == NULL) |
5493 | { | 5464 | { |
5494 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 5465 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
5495 | _("Could not access PEERINFO service. Exiting.\n")); | 5466 | _("Could not access PEERINFO service. Exiting.\n")); |
5496 | GNUNET_SCHEDULER_shutdown (s); | 5467 | GNUNET_SCHEDULER_shutdown (); |
5497 | if (stats != NULL) | 5468 | if (stats != NULL) |
5498 | { | 5469 | { |
5499 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); | 5470 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); |
@@ -5511,7 +5482,7 @@ run (void *cls, | |||
5511 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 5482 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
5512 | _ | 5483 | _ |
5513 | ("Transport service could not access hostkey. Exiting.\n")); | 5484 | ("Transport service could not access hostkey. Exiting.\n")); |
5514 | GNUNET_SCHEDULER_shutdown (s); | 5485 | GNUNET_SCHEDULER_shutdown (); |
5515 | if (stats != NULL) | 5486 | if (stats != NULL) |
5516 | { | 5487 | { |
5517 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); | 5488 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); |
@@ -5544,8 +5515,7 @@ run (void *cls, | |||
5544 | } | 5515 | } |
5545 | GNUNET_free (plugs); | 5516 | GNUNET_free (plugs); |
5546 | } | 5517 | } |
5547 | GNUNET_SCHEDULER_add_delayed (sched, | 5518 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
5548 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
5549 | &shutdown_task, NULL); | 5519 | &shutdown_task, NULL); |
5550 | if (no_transports) | 5520 | if (no_transports) |
5551 | refresh_hello (); | 5521 | refresh_hello (); |
diff --git a/src/transport/plugin_transport.h b/src/transport/plugin_transport.h index a8e15ac8a..5f6d6fcfb 100644 --- a/src/transport/plugin_transport.h +++ b/src/transport/plugin_transport.h | |||
@@ -190,11 +190,6 @@ struct GNUNET_TRANSPORT_PluginEnvironment | |||
190 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 190 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
191 | 191 | ||
192 | /** | 192 | /** |
193 | * Scheduler to use. | ||
194 | */ | ||
195 | struct GNUNET_SCHEDULER_Handle *sched; | ||
196 | |||
197 | /** | ||
198 | * Identity of this peer. | 193 | * Identity of this peer. |
199 | */ | 194 | */ |
200 | const struct GNUNET_PeerIdentity *my_identity; | 195 | const struct GNUNET_PeerIdentity *my_identity; |
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index e4c88903f..ad8ced567 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -880,14 +880,14 @@ static void mhd_write_mst_cb (void *cls, | |||
880 | 0); | 880 | 0); |
881 | pc->delay = delay; | 881 | pc->delay = delay; |
882 | if (pc->reset_task != GNUNET_SCHEDULER_NO_TASK) | 882 | if (pc->reset_task != GNUNET_SCHEDULER_NO_TASK) |
883 | GNUNET_SCHEDULER_cancel (pc->plugin->env->sched, pc->reset_task); | 883 | GNUNET_SCHEDULER_cancel (pc->reset_task); |
884 | 884 | ||
885 | if (delay.rel_value > 0) | 885 | if (delay.rel_value > 0) |
886 | { | 886 | { |
887 | #if DEBUG_HTTP | 887 | #if DEBUG_HTTP |
888 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Inbound quota management: delay next read for %llu ms \n", ps, delay.rel_value); | 888 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Inbound quota management: delay next read for %llu ms \n", ps, delay.rel_value); |
889 | #endif | 889 | #endif |
890 | pc->reset_task = GNUNET_SCHEDULER_add_delayed (pc->plugin->env->sched, delay, &reset_inbound_quota_delay, pc); | 890 | pc->reset_task = GNUNET_SCHEDULER_add_delayed (delay, &reset_inbound_quota_delay, pc); |
891 | } | 891 | } |
892 | } | 892 | } |
893 | 893 | ||
@@ -1274,12 +1274,11 @@ http_server_daemon_prepare (struct Plugin *plugin , struct MHD_Daemon *daemon_ha | |||
1274 | { | 1274 | { |
1275 | if (plugin->http_server_task_v4 != GNUNET_SCHEDULER_NO_TASK) | 1275 | if (plugin->http_server_task_v4 != GNUNET_SCHEDULER_NO_TASK) |
1276 | { | 1276 | { |
1277 | GNUNET_SCHEDULER_cancel(plugin->env->sched, plugin->http_server_task_v4); | 1277 | GNUNET_SCHEDULER_cancel(plugin->http_server_task_v4); |
1278 | plugin->http_server_daemon_v4 = GNUNET_SCHEDULER_NO_TASK; | 1278 | plugin->http_server_daemon_v4 = GNUNET_SCHEDULER_NO_TASK; |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | ret = GNUNET_SCHEDULER_add_select (plugin->env->sched, | 1281 | ret = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1282 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | ||
1283 | GNUNET_SCHEDULER_NO_TASK, | 1282 | GNUNET_SCHEDULER_NO_TASK, |
1284 | tv, | 1283 | tv, |
1285 | wrs, | 1284 | wrs, |
@@ -1291,12 +1290,11 @@ http_server_daemon_prepare (struct Plugin *plugin , struct MHD_Daemon *daemon_ha | |||
1291 | { | 1290 | { |
1292 | if (plugin->http_server_task_v6 != GNUNET_SCHEDULER_NO_TASK) | 1291 | if (plugin->http_server_task_v6 != GNUNET_SCHEDULER_NO_TASK) |
1293 | { | 1292 | { |
1294 | GNUNET_SCHEDULER_cancel(plugin->env->sched, plugin->http_server_task_v6); | 1293 | GNUNET_SCHEDULER_cancel(plugin->http_server_task_v6); |
1295 | plugin->http_server_task_v6 = GNUNET_SCHEDULER_NO_TASK; | 1294 | plugin->http_server_task_v6 = GNUNET_SCHEDULER_NO_TASK; |
1296 | } | 1295 | } |
1297 | 1296 | ||
1298 | ret = GNUNET_SCHEDULER_add_select (plugin->env->sched, | 1297 | ret = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1299 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | ||
1300 | GNUNET_SCHEDULER_NO_TASK, | 1298 | GNUNET_SCHEDULER_NO_TASK, |
1301 | tv, | 1299 | tv, |
1302 | wrs, | 1300 | wrs, |
@@ -1586,14 +1584,14 @@ static void curl_receive_mst_cb (void *cls, | |||
1586 | 1584 | ||
1587 | pc->delay = delay; | 1585 | pc->delay = delay; |
1588 | if (pc->reset_task != GNUNET_SCHEDULER_NO_TASK) | 1586 | if (pc->reset_task != GNUNET_SCHEDULER_NO_TASK) |
1589 | GNUNET_SCHEDULER_cancel (pc->plugin->env->sched, pc->reset_task); | 1587 | GNUNET_SCHEDULER_cancel (pc->reset_task); |
1590 | 1588 | ||
1591 | if (delay.rel_value > 0) | 1589 | if (delay.rel_value > 0) |
1592 | { | 1590 | { |
1593 | #if DEBUG_HTTP | 1591 | #if DEBUG_HTTP |
1594 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Inbound quota management: delay next read for %llu ms \n", ps, delay.abs_value); | 1592 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: Inbound quota management: delay next read for %llu ms \n", ps, delay.abs_value); |
1595 | #endif | 1593 | #endif |
1596 | pc->reset_task = GNUNET_SCHEDULER_add_delayed (pc->plugin->env->sched, delay, &reset_inbound_quota_delay, pc); | 1594 | pc->reset_task = GNUNET_SCHEDULER_add_delayed (delay, &reset_inbound_quota_delay, pc); |
1597 | } | 1595 | } |
1598 | } | 1596 | } |
1599 | 1597 | ||
@@ -1820,7 +1818,7 @@ static int curl_schedule(struct Plugin *plugin) | |||
1820 | /* Cancel previous scheduled task */ | 1818 | /* Cancel previous scheduled task */ |
1821 | if (plugin->http_curl_task != GNUNET_SCHEDULER_NO_TASK) | 1819 | if (plugin->http_curl_task != GNUNET_SCHEDULER_NO_TASK) |
1822 | { | 1820 | { |
1823 | GNUNET_SCHEDULER_cancel(plugin->env->sched, plugin->http_curl_task); | 1821 | GNUNET_SCHEDULER_cancel(plugin->http_curl_task); |
1824 | plugin->http_curl_task = GNUNET_SCHEDULER_NO_TASK; | 1822 | plugin->http_curl_task = GNUNET_SCHEDULER_NO_TASK; |
1825 | } | 1823 | } |
1826 | 1824 | ||
@@ -1851,8 +1849,7 @@ static int curl_schedule(struct Plugin *plugin) | |||
1851 | gws = GNUNET_NETWORK_fdset_create (); | 1849 | gws = GNUNET_NETWORK_fdset_create (); |
1852 | GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1); | 1850 | GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1); |
1853 | GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1); | 1851 | GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1); |
1854 | plugin->http_curl_task = GNUNET_SCHEDULER_add_select (plugin->env->sched, | 1852 | plugin->http_curl_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1855 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | ||
1856 | GNUNET_SCHEDULER_NO_TASK, | 1853 | GNUNET_SCHEDULER_NO_TASK, |
1857 | (to == -1) ? GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) : GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, to), | 1854 | (to == -1) ? GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) : GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, to), |
1858 | grs, | 1855 | grs, |
@@ -1958,10 +1955,10 @@ static int send_check_connections (struct Plugin *plugin, struct Session *ps) | |||
1958 | } | 1955 | } |
1959 | if (plugin->http_curl_task != GNUNET_SCHEDULER_NO_TASK) | 1956 | if (plugin->http_curl_task != GNUNET_SCHEDULER_NO_TASK) |
1960 | { | 1957 | { |
1961 | GNUNET_SCHEDULER_cancel(plugin->env->sched, plugin->http_curl_task); | 1958 | GNUNET_SCHEDULER_cancel(plugin->http_curl_task); |
1962 | plugin->http_curl_task = GNUNET_SCHEDULER_NO_TASK; | 1959 | plugin->http_curl_task = GNUNET_SCHEDULER_NO_TASK; |
1963 | } | 1960 | } |
1964 | plugin->http_curl_task = GNUNET_SCHEDULER_add_now (plugin->env->sched, &curl_perform, plugin); | 1961 | plugin->http_curl_task = GNUNET_SCHEDULER_add_now (&curl_perform, plugin); |
1965 | } | 1962 | } |
1966 | 1963 | ||
1967 | /* waiting for receive direction */ | 1964 | /* waiting for receive direction */ |
@@ -1989,10 +1986,10 @@ static int send_check_connections (struct Plugin *plugin, struct Session *ps) | |||
1989 | ps->send_active=GNUNET_YES; | 1986 | ps->send_active=GNUNET_YES; |
1990 | if (plugin->http_curl_task != GNUNET_SCHEDULER_NO_TASK) | 1987 | if (plugin->http_curl_task != GNUNET_SCHEDULER_NO_TASK) |
1991 | { | 1988 | { |
1992 | GNUNET_SCHEDULER_cancel(plugin->env->sched, plugin->http_curl_task); | 1989 | GNUNET_SCHEDULER_cancel(plugin->http_curl_task); |
1993 | plugin->http_curl_task = GNUNET_SCHEDULER_NO_TASK; | 1990 | plugin->http_curl_task = GNUNET_SCHEDULER_NO_TASK; |
1994 | } | 1991 | } |
1995 | plugin->http_curl_task = GNUNET_SCHEDULER_add_now (plugin->env->sched, &curl_perform, plugin); | 1992 | plugin->http_curl_task = GNUNET_SCHEDULER_add_now (&curl_perform, plugin); |
1996 | return GNUNET_YES; | 1993 | return GNUNET_YES; |
1997 | } | 1994 | } |
1998 | else | 1995 | else |
@@ -2058,10 +2055,10 @@ static int send_check_connections (struct Plugin *plugin, struct Session *ps) | |||
2058 | } | 2055 | } |
2059 | if (plugin->http_curl_task != GNUNET_SCHEDULER_NO_TASK) | 2056 | if (plugin->http_curl_task != GNUNET_SCHEDULER_NO_TASK) |
2060 | { | 2057 | { |
2061 | GNUNET_SCHEDULER_cancel(plugin->env->sched, plugin->http_curl_task); | 2058 | GNUNET_SCHEDULER_cancel(plugin->http_curl_task); |
2062 | plugin->http_curl_task = GNUNET_SCHEDULER_NO_TASK; | 2059 | plugin->http_curl_task = GNUNET_SCHEDULER_NO_TASK; |
2063 | } | 2060 | } |
2064 | plugin->http_curl_task = GNUNET_SCHEDULER_add_now (plugin->env->sched, &curl_perform, plugin); | 2061 | plugin->http_curl_task = GNUNET_SCHEDULER_add_now (&curl_perform, plugin); |
2065 | return GNUNET_YES; | 2062 | return GNUNET_YES; |
2066 | } | 2063 | } |
2067 | if (ps->direction == INBOUND) | 2064 | if (ps->direction == INBOUND) |
@@ -2658,13 +2655,13 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) | |||
2658 | 2655 | ||
2659 | if ( plugin->http_server_task_v4 != GNUNET_SCHEDULER_NO_TASK) | 2656 | if ( plugin->http_server_task_v4 != GNUNET_SCHEDULER_NO_TASK) |
2660 | { | 2657 | { |
2661 | GNUNET_SCHEDULER_cancel(plugin->env->sched, plugin->http_server_task_v4); | 2658 | GNUNET_SCHEDULER_cancel(plugin->http_server_task_v4); |
2662 | plugin->http_server_task_v4 = GNUNET_SCHEDULER_NO_TASK; | 2659 | plugin->http_server_task_v4 = GNUNET_SCHEDULER_NO_TASK; |
2663 | } | 2660 | } |
2664 | 2661 | ||
2665 | if ( plugin->http_server_task_v6 != GNUNET_SCHEDULER_NO_TASK) | 2662 | if ( plugin->http_server_task_v6 != GNUNET_SCHEDULER_NO_TASK) |
2666 | { | 2663 | { |
2667 | GNUNET_SCHEDULER_cancel(plugin->env->sched, plugin->http_server_task_v6); | 2664 | GNUNET_SCHEDULER_cancel(plugin->http_server_task_v6); |
2668 | plugin->http_server_task_v6 = GNUNET_SCHEDULER_NO_TASK; | 2665 | plugin->http_server_task_v6 = GNUNET_SCHEDULER_NO_TASK; |
2669 | } | 2666 | } |
2670 | 2667 | ||
@@ -2703,7 +2700,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) | |||
2703 | 2700 | ||
2704 | if ( plugin->http_curl_task != GNUNET_SCHEDULER_NO_TASK) | 2701 | if ( plugin->http_curl_task != GNUNET_SCHEDULER_NO_TASK) |
2705 | { | 2702 | { |
2706 | GNUNET_SCHEDULER_cancel(plugin->env->sched, plugin->http_curl_task); | 2703 | GNUNET_SCHEDULER_cancel(plugin->http_curl_task); |
2707 | plugin->http_curl_task = GNUNET_SCHEDULER_NO_TASK; | 2704 | plugin->http_curl_task = GNUNET_SCHEDULER_NO_TASK; |
2708 | } | 2705 | } |
2709 | 2706 | ||
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 1073b24b7..b4d332d48 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -892,8 +892,7 @@ disconnect_session (struct Session *session) | |||
892 | GNUNET_break (session->client != NULL); | 892 | GNUNET_break (session->client != NULL); |
893 | if (session->receive_delay_task != GNUNET_SCHEDULER_NO_TASK) | 893 | if (session->receive_delay_task != GNUNET_SCHEDULER_NO_TASK) |
894 | { | 894 | { |
895 | GNUNET_SCHEDULER_cancel (session->plugin->env->sched, | 895 | GNUNET_SCHEDULER_cancel (session->receive_delay_task); |
896 | session->receive_delay_task); | ||
897 | if (session->client != NULL) | 896 | if (session->client != NULL) |
898 | GNUNET_SERVER_receive_done (session->client, | 897 | GNUNET_SERVER_receive_done (session->client, |
899 | GNUNET_SYSERR); | 898 | GNUNET_SYSERR); |
@@ -1228,8 +1227,7 @@ tcp_plugin_send (void *cls, | |||
1228 | /* Only do one NAT punch attempt per peer identity */ | 1227 | /* Only do one NAT punch attempt per peer identity */ |
1229 | return -1; | 1228 | return -1; |
1230 | } | 1229 | } |
1231 | sa = GNUNET_CONNECTION_create_from_sockaddr (plugin->env->sched, | 1230 | sa = GNUNET_CONNECTION_create_from_sockaddr (af, sb, sbs); |
1232 | af, sb, sbs); | ||
1233 | if (sa == NULL) | 1231 | if (sa == NULL) |
1234 | { | 1232 | { |
1235 | #if DEBUG_TCP | 1233 | #if DEBUG_TCP |
@@ -1456,8 +1454,7 @@ tcp_plugin_address_pretty_printer (void *cls, | |||
1456 | ppc->asc = asc; | 1454 | ppc->asc = asc; |
1457 | ppc->asc_cls = asc_cls; | 1455 | ppc->asc_cls = asc_cls; |
1458 | ppc->port = port; | 1456 | ppc->port = port; |
1459 | GNUNET_RESOLVER_hostname_get (plugin->env->sched, | 1457 | GNUNET_RESOLVER_hostname_get (plugin->env->cfg, |
1460 | plugin->env->cfg, | ||
1461 | sb, | 1458 | sb, |
1462 | sbs, | 1459 | sbs, |
1463 | !numeric, timeout, &append_port, ppc); | 1460 | !numeric, timeout, &append_port, ppc); |
@@ -1812,8 +1809,7 @@ delayed_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1812 | GNUNET_SERVER_receive_done (session->client, GNUNET_OK); | 1809 | GNUNET_SERVER_receive_done (session->client, GNUNET_OK); |
1813 | else | 1810 | else |
1814 | session->receive_delay_task = | 1811 | session->receive_delay_task = |
1815 | GNUNET_SCHEDULER_add_delayed (session->plugin->env->sched, | 1812 | GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session); |
1816 | delay, &delayed_done, session); | ||
1817 | } | 1813 | } |
1818 | 1814 | ||
1819 | 1815 | ||
@@ -1866,8 +1862,7 @@ handle_tcp_data (void *cls, | |||
1866 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 1862 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
1867 | else | 1863 | else |
1868 | session->receive_delay_task = | 1864 | session->receive_delay_task = |
1869 | GNUNET_SCHEDULER_add_delayed (session->plugin->env->sched, | 1865 | GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session); |
1870 | delay, &delayed_done, session); | ||
1871 | } | 1866 | } |
1872 | 1867 | ||
1873 | 1868 | ||
@@ -2115,8 +2110,7 @@ tcp_plugin_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
2115 | else | 2110 | else |
2116 | { | 2111 | { |
2117 | plugin->server_read_task = | 2112 | plugin->server_read_task = |
2118 | GNUNET_SCHEDULER_add_read_file (plugin->env->sched, | 2113 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
2119 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
2120 | plugin->server_stdout_handle, &tcp_plugin_server_read, plugin); | 2114 | plugin->server_stdout_handle, &tcp_plugin_server_read, plugin); |
2121 | return; | 2115 | return; |
2122 | } | 2116 | } |
@@ -2134,8 +2128,7 @@ tcp_plugin_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
2134 | _("nat-server-read malformed address\n"), &mybuf, port); | 2128 | _("nat-server-read malformed address\n"), &mybuf, port); |
2135 | 2129 | ||
2136 | plugin->server_read_task = | 2130 | plugin->server_read_task = |
2137 | GNUNET_SCHEDULER_add_read_file (plugin->env->sched, | 2131 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
2138 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
2139 | plugin->server_stdout_handle, &tcp_plugin_server_read, plugin); | 2132 | plugin->server_stdout_handle, &tcp_plugin_server_read, plugin); |
2140 | return; | 2133 | return; |
2141 | } | 2134 | } |
@@ -2146,15 +2139,14 @@ tcp_plugin_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
2146 | * We have received an ICMP response, ostensibly from a non-NAT'd peer | 2139 | * We have received an ICMP response, ostensibly from a non-NAT'd peer |
2147 | * that wants to connect to us! Send a message to establish a connection. | 2140 | * that wants to connect to us! Send a message to establish a connection. |
2148 | */ | 2141 | */ |
2149 | sock = GNUNET_CONNECTION_create_from_sockaddr (plugin->env->sched, AF_INET, (struct sockaddr *)&in_addr, | 2142 | sock = GNUNET_CONNECTION_create_from_sockaddr (AF_INET, (struct sockaddr *)&in_addr, |
2150 | sizeof(in_addr)); | 2143 | sizeof(in_addr)); |
2151 | 2144 | ||
2152 | 2145 | ||
2153 | if (sock == NULL) | 2146 | if (sock == NULL) |
2154 | { | 2147 | { |
2155 | plugin->server_read_task = | 2148 | plugin->server_read_task = |
2156 | GNUNET_SCHEDULER_add_read_file (plugin->env->sched, | 2149 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
2157 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
2158 | plugin->server_stdout_handle, &tcp_plugin_server_read, plugin); | 2150 | plugin->server_stdout_handle, &tcp_plugin_server_read, plugin); |
2159 | return; | 2151 | return; |
2160 | } | 2152 | } |
@@ -2178,8 +2170,7 @@ tcp_plugin_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
2178 | 2170 | ||
2179 | /*GNUNET_SERVER_connect_socket(plugin->server, sock);*/ | 2171 | /*GNUNET_SERVER_connect_socket(plugin->server, sock);*/ |
2180 | plugin->server_read_task = | 2172 | plugin->server_read_task = |
2181 | GNUNET_SCHEDULER_add_read_file (plugin->env->sched, | 2173 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
2182 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
2183 | plugin->server_stdout_handle, &tcp_plugin_server_read, plugin); | 2174 | plugin->server_stdout_handle, &tcp_plugin_server_read, plugin); |
2184 | } | 2175 | } |
2185 | 2176 | ||
@@ -2217,8 +2208,7 @@ tcp_transport_start_nat_server(struct Plugin *plugin) | |||
2217 | 2208 | ||
2218 | plugin->server_stdout_handle = GNUNET_DISK_pipe_handle(plugin->server_stdout, GNUNET_DISK_PIPE_END_READ); | 2209 | plugin->server_stdout_handle = GNUNET_DISK_pipe_handle(plugin->server_stdout, GNUNET_DISK_PIPE_END_READ); |
2219 | plugin->server_read_task = | 2210 | plugin->server_read_task = |
2220 | GNUNET_SCHEDULER_add_read_file (plugin->env->sched, | 2211 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
2221 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
2222 | plugin->server_stdout_handle, &tcp_plugin_server_read, plugin); | 2212 | plugin->server_stdout_handle, &tcp_plugin_server_read, plugin); |
2223 | return GNUNET_YES; | 2213 | return GNUNET_YES; |
2224 | } | 2214 | } |
@@ -2363,7 +2353,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
2363 | struct sockaddr_in in_addr; | 2353 | struct sockaddr_in in_addr; |
2364 | struct IPv4TcpAddress t4; | 2354 | struct IPv4TcpAddress t4; |
2365 | 2355 | ||
2366 | service = GNUNET_SERVICE_start ("transport-tcp", env->sched, env->cfg); | 2356 | service = GNUNET_SERVICE_start ("transport-tcp", env->cfg); |
2367 | if (service == NULL) | 2357 | if (service == NULL) |
2368 | { | 2358 | { |
2369 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 2359 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -2545,8 +2535,7 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
2545 | GNUNET_OS_network_interfaces_list (&process_interfaces, plugin); | 2535 | GNUNET_OS_network_interfaces_list (&process_interfaces, plugin); |
2546 | } | 2536 | } |
2547 | 2537 | ||
2548 | plugin->hostname_dns = GNUNET_RESOLVER_hostname_resolve (env->sched, | 2538 | plugin->hostname_dns = GNUNET_RESOLVER_hostname_resolve (env->cfg, |
2549 | env->cfg, | ||
2550 | AF_UNSPEC, | 2539 | AF_UNSPEC, |
2551 | HOSTNAME_RESOLVE_TIMEOUT, | 2540 | HOSTNAME_RESOLVE_TIMEOUT, |
2552 | &process_hostname_ips, | 2541 | &process_hostname_ips, |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 4bd8c36d3..5c3682e2a 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -513,7 +513,7 @@ udp_transport_server_stop (void *cls) | |||
513 | 513 | ||
514 | if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK) | 514 | if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK) |
515 | { | 515 | { |
516 | GNUNET_SCHEDULER_cancel (plugin->env->sched, plugin->select_task); | 516 | GNUNET_SCHEDULER_cancel (plugin->select_task); |
517 | plugin->select_task = GNUNET_SCHEDULER_NO_TASK; | 517 | plugin->select_task = GNUNET_SCHEDULER_NO_TASK; |
518 | } | 518 | } |
519 | if (plugin->udp_sockv4.desc != NULL) | 519 | if (plugin->udp_sockv4.desc != NULL) |
@@ -1107,7 +1107,7 @@ void | |||
1107 | udp_probe_continuation (void *cls, const struct GNUNET_PeerIdentity *target, int result) | 1107 | udp_probe_continuation (void *cls, const struct GNUNET_PeerIdentity *target, int result) |
1108 | { | 1108 | { |
1109 | struct UDP_NAT_Probes *probe = cls; | 1109 | struct UDP_NAT_Probes *probe = cls; |
1110 | struct Plugin *plugin = probe->plugin; | 1110 | /*struct Plugin *plugin = probe->plugin;*/ |
1111 | 1111 | ||
1112 | if ((result == GNUNET_OK) && (probe->count < MAX_PROBES)) | 1112 | if ((result == GNUNET_OK) && (probe->count < MAX_PROBES)) |
1113 | { | 1113 | { |
@@ -1115,7 +1115,7 @@ udp_probe_continuation (void *cls, const struct GNUNET_PeerIdentity *target, int | |||
1115 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1115 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1116 | _("Scheduling next probe for 10000 milliseconds\n")); | 1116 | _("Scheduling next probe for 10000 milliseconds\n")); |
1117 | #endif | 1117 | #endif |
1118 | probe->task = GNUNET_SCHEDULER_add_delayed(plugin->env->sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 10000), &send_udp_probe_message, probe); | 1118 | probe->task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 10000), &send_udp_probe_message, probe); |
1119 | } | 1119 | } |
1120 | else /* Destroy the probe context. */ | 1120 | else /* Destroy the probe context. */ |
1121 | { | 1121 | { |
@@ -1200,8 +1200,7 @@ udp_plugin_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
1200 | else | 1200 | else |
1201 | { | 1201 | { |
1202 | plugin->server_read_task = | 1202 | plugin->server_read_task = |
1203 | GNUNET_SCHEDULER_add_read_file (plugin->env->sched, | 1203 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
1204 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1205 | plugin->server_stdout_handle, &udp_plugin_server_read, plugin); | 1204 | plugin->server_stdout_handle, &udp_plugin_server_read, plugin); |
1206 | return; | 1205 | return; |
1207 | } | 1206 | } |
@@ -1222,8 +1221,7 @@ udp_plugin_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
1222 | _("nat-server-read malformed address\n"), &mybuf, port); | 1221 | _("nat-server-read malformed address\n"), &mybuf, port); |
1223 | 1222 | ||
1224 | plugin->server_read_task = | 1223 | plugin->server_read_task = |
1225 | GNUNET_SCHEDULER_add_read_file (plugin->env->sched, | 1224 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
1226 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1227 | plugin->server_stdout_handle, &udp_plugin_server_read, plugin); | 1225 | plugin->server_stdout_handle, &udp_plugin_server_read, plugin); |
1228 | return; | 1226 | return; |
1229 | } | 1227 | } |
@@ -1238,13 +1236,12 @@ udp_plugin_server_read (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
1238 | temp_probe->addr.u_port = htons(port); | 1236 | temp_probe->addr.u_port = htons(port); |
1239 | temp_probe->next = plugin->probes; | 1237 | temp_probe->next = plugin->probes; |
1240 | temp_probe->plugin = plugin; | 1238 | temp_probe->plugin = plugin; |
1241 | temp_probe->task = GNUNET_SCHEDULER_add_delayed(plugin->env->sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 500), &send_udp_probe_message, temp_probe); | 1239 | temp_probe->task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 500), &send_udp_probe_message, temp_probe); |
1242 | plugin->probes = temp_probe; | 1240 | plugin->probes = temp_probe; |
1243 | } | 1241 | } |
1244 | 1242 | ||
1245 | plugin->server_read_task = | 1243 | plugin->server_read_task = |
1246 | GNUNET_SCHEDULER_add_read_file (plugin->env->sched, | 1244 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
1247 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1248 | plugin->server_stdout_handle, &udp_plugin_server_read, plugin); | 1245 | plugin->server_stdout_handle, &udp_plugin_server_read, plugin); |
1249 | 1246 | ||
1250 | } | 1247 | } |
@@ -1358,7 +1355,7 @@ udp_demultiplexer(struct Plugin *plugin, struct GNUNET_PeerIdentity *sender, | |||
1358 | 1355 | ||
1359 | if (outgoing_probe->task != GNUNET_SCHEDULER_NO_TASK) | 1356 | if (outgoing_probe->task != GNUNET_SCHEDULER_NO_TASK) |
1360 | { | 1357 | { |
1361 | GNUNET_SCHEDULER_cancel(plugin->env->sched, outgoing_probe->task); | 1358 | GNUNET_SCHEDULER_cancel(outgoing_probe->task); |
1362 | outgoing_probe->task = GNUNET_SCHEDULER_NO_TASK; | 1359 | outgoing_probe->task = GNUNET_SCHEDULER_NO_TASK; |
1363 | /* Schedule task to timeout and remove probe if confirmation not received */ | 1360 | /* Schedule task to timeout and remove probe if confirmation not received */ |
1364 | } | 1361 | } |
@@ -1569,8 +1566,7 @@ udp_plugin_select (void *cls, | |||
1569 | { | 1566 | { |
1570 | GNUNET_break_op (0); | 1567 | GNUNET_break_op (0); |
1571 | plugin->select_task = | 1568 | plugin->select_task = |
1572 | GNUNET_SCHEDULER_add_select (plugin->env->sched, | 1569 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1573 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | ||
1574 | GNUNET_SCHEDULER_NO_TASK, | 1570 | GNUNET_SCHEDULER_NO_TASK, |
1575 | GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs, | 1571 | GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs, |
1576 | NULL, &udp_plugin_select, plugin); | 1572 | NULL, &udp_plugin_select, plugin); |
@@ -1581,8 +1577,7 @@ udp_plugin_select (void *cls, | |||
1581 | { | 1577 | { |
1582 | GNUNET_break_op (0); | 1578 | GNUNET_break_op (0); |
1583 | plugin->select_task = | 1579 | plugin->select_task = |
1584 | GNUNET_SCHEDULER_add_select (plugin->env->sched, | 1580 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1585 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | ||
1586 | GNUNET_SCHEDULER_NO_TASK, | 1581 | GNUNET_SCHEDULER_NO_TASK, |
1587 | GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs, | 1582 | GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs, |
1588 | NULL, &udp_plugin_select, plugin); | 1583 | NULL, &udp_plugin_select, plugin); |
@@ -1601,8 +1596,7 @@ udp_plugin_select (void *cls, | |||
1601 | count++; | 1596 | count++; |
1602 | } | 1597 | } |
1603 | plugin->select_task = | 1598 | plugin->select_task = |
1604 | GNUNET_SCHEDULER_add_select (plugin->env->sched, | 1599 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1605 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | ||
1606 | GNUNET_SCHEDULER_NO_TASK, | 1600 | GNUNET_SCHEDULER_NO_TASK, |
1607 | GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs, | 1601 | GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs, |
1608 | NULL, &udp_plugin_select, plugin); | 1602 | NULL, &udp_plugin_select, plugin); |
@@ -1659,8 +1653,7 @@ udp_transport_server_start (void *cls) | |||
1659 | 1653 | ||
1660 | plugin->server_stdout_handle = GNUNET_DISK_pipe_handle(plugin->server_stdout, GNUNET_DISK_PIPE_END_READ); | 1654 | plugin->server_stdout_handle = GNUNET_DISK_pipe_handle(plugin->server_stdout, GNUNET_DISK_PIPE_END_READ); |
1661 | plugin->server_read_task = | 1655 | plugin->server_read_task = |
1662 | GNUNET_SCHEDULER_add_read_file (plugin->env->sched, | 1656 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
1663 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1664 | plugin->server_stdout_handle, &udp_plugin_server_read, plugin); | 1657 | plugin->server_stdout_handle, &udp_plugin_server_read, plugin); |
1665 | } | 1658 | } |
1666 | 1659 | ||
@@ -1783,8 +1776,7 @@ udp_transport_server_start (void *cls) | |||
1783 | plugin->udp_sockv6.desc); | 1776 | plugin->udp_sockv6.desc); |
1784 | 1777 | ||
1785 | plugin->select_task = | 1778 | plugin->select_task = |
1786 | GNUNET_SCHEDULER_add_select (plugin->env->sched, | 1779 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
1787 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | ||
1788 | GNUNET_SCHEDULER_NO_TASK, | 1780 | GNUNET_SCHEDULER_NO_TASK, |
1789 | GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs, | 1781 | GNUNET_TIME_UNIT_FOREVER_REL, plugin->rs, |
1790 | NULL, &udp_plugin_select, plugin); | 1782 | NULL, &udp_plugin_select, plugin); |
@@ -1992,8 +1984,7 @@ udp_plugin_address_pretty_printer (void *cls, | |||
1992 | ppc->asc = asc; | 1984 | ppc->asc = asc; |
1993 | ppc->asc_cls = asc_cls; | 1985 | ppc->asc_cls = asc_cls; |
1994 | ppc->port = port; | 1986 | ppc->port = port; |
1995 | GNUNET_RESOLVER_hostname_get (plugin->env->sched, | 1987 | GNUNET_RESOLVER_hostname_get (plugin->env->cfg, |
1996 | plugin->env->cfg, | ||
1997 | sb, | 1988 | sb, |
1998 | sbs, | 1989 | sbs, |
1999 | !numeric, timeout, &append_port, ppc); | 1990 | !numeric, timeout, &append_port, ppc); |
@@ -2167,7 +2158,7 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
2167 | char *external_address; | 2158 | char *external_address; |
2168 | struct IPv4UdpAddress v4_address; | 2159 | struct IPv4UdpAddress v4_address; |
2169 | 2160 | ||
2170 | service = GNUNET_SERVICE_start ("transport-udp", env->sched, env->cfg); | 2161 | service = GNUNET_SERVICE_start ("transport-udp", env->cfg); |
2171 | if (service == NULL) | 2162 | if (service == NULL) |
2172 | { | 2163 | { |
2173 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ | 2164 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _ |
@@ -2308,8 +2299,7 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
2308 | GNUNET_OS_network_interfaces_list (&process_interfaces, plugin); | 2299 | GNUNET_OS_network_interfaces_list (&process_interfaces, plugin); |
2309 | } | 2300 | } |
2310 | 2301 | ||
2311 | plugin->hostname_dns = GNUNET_RESOLVER_hostname_resolve (env->sched, | 2302 | plugin->hostname_dns = GNUNET_RESOLVER_hostname_resolve (env->cfg, |
2312 | env->cfg, | ||
2313 | AF_UNSPEC, | 2303 | AF_UNSPEC, |
2314 | HOSTNAME_RESOLVE_TIMEOUT, | 2304 | HOSTNAME_RESOLVE_TIMEOUT, |
2315 | &process_hostname_ips, | 2305 | &process_hostname_ips, |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 0f95f48c7..41f2958a2 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -682,8 +682,7 @@ do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
682 | } else { | 682 | } else { |
683 | //nothing to send at the moment | 683 | //nothing to send at the moment |
684 | plugin->server_read_task = | 684 | plugin->server_read_task = |
685 | GNUNET_SCHEDULER_add_delayed (plugin->env->sched, | 685 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining(nextsend), |
686 | GNUNET_TIME_absolute_get_remaining(nextsend), | ||
687 | &do_transmit, plugin); | 686 | &do_transmit, plugin); |
688 | 687 | ||
689 | } | 688 | } |
@@ -804,8 +803,7 @@ do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
804 | } | 803 | } |
805 | 804 | ||
806 | //plugin->server_read_task = | 805 | //plugin->server_read_task = |
807 | //GNUNET_SCHEDULER_add_read_file (plugin->env->sched, | 806 | //GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
808 | // GNUNET_TIME_UNIT_FOREVER_REL, | ||
809 | // plugin->server_stdout_handle, &wlan_plugin_helper_read, plugin); | 807 | // plugin->server_stdout_handle, &wlan_plugin_helper_read, plugin); |
810 | 808 | ||
811 | } | 809 | } |
@@ -837,8 +835,7 @@ process_pending_messages (struct Plugin * plugin) | |||
837 | 835 | ||
838 | // GNUNET_TIME_UNIT_FOREVER_REL is needed to clean up old msg | 836 | // GNUNET_TIME_UNIT_FOREVER_REL is needed to clean up old msg |
839 | plugin->server_write_task | 837 | plugin->server_write_task |
840 | = GNUNET_SCHEDULER_add_write_file(plugin->env->sched, | 838 | = GNUNET_SCHEDULER_add_write_file(GNUNET_TIME_UNIT_FOREVER_REL, |
841 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
842 | plugin->server_stdin_handle, | 839 | plugin->server_stdin_handle, |
843 | &do_transmit, | 840 | &do_transmit, |
844 | plugin); | 841 | plugin); |
@@ -1264,8 +1261,7 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin) | |||
1264 | plugin->server_stdin_handle = GNUNET_DISK_pipe_handle(plugin->server_stdin, GNUNET_DISK_PIPE_END_WRITE); | 1261 | plugin->server_stdin_handle = GNUNET_DISK_pipe_handle(plugin->server_stdin, GNUNET_DISK_PIPE_END_WRITE); |
1265 | 1262 | ||
1266 | plugin->server_read_task = | 1263 | plugin->server_read_task = |
1267 | GNUNET_SCHEDULER_add_read_file (plugin->env->sched, | 1264 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, |
1268 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
1269 | plugin->server_stdout_handle, &wlan_plugin_helper_read, plugin); | 1265 | plugin->server_stdout_handle, &wlan_plugin_helper_read, plugin); |
1270 | return GNUNET_YES; | 1266 | return GNUNET_YES; |
1271 | } | 1267 | } |
@@ -1288,7 +1284,7 @@ gnunet_plugin_transport_wlan_init (void *cls) | |||
1288 | 1284 | ||
1289 | GNUNET_assert(cls !=NULL); | 1285 | GNUNET_assert(cls !=NULL); |
1290 | 1286 | ||
1291 | service = GNUNET_SERVICE_start ("transport-wlan", env->sched, env->cfg); | 1287 | service = GNUNET_SERVICE_start ("transport-wlan", env->cfg); |
1292 | if (service == NULL){ | 1288 | if (service == NULL){ |
1293 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1289 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1294 | _("Failed to start service for `%s' transport plugin.\n"), | 1290 | _("Failed to start service for `%s' transport plugin.\n"), |
diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index 398dcf92b..11e00b80e 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c | |||
@@ -60,11 +60,6 @@ static struct GNUNET_PeerIdentity my_identity; | |||
60 | static struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key; | 60 | static struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Our scheduler. | ||
64 | */ | ||
65 | struct GNUNET_SCHEDULER_Handle *sched; | ||
66 | |||
67 | /** | ||
68 | * Our configuration. | 63 | * Our configuration. |
69 | */ | 64 | */ |
70 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 65 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -168,8 +163,7 @@ test_validation () | |||
168 | api->check_address (api->cls, | 163 | api->check_address (api->cls, |
169 | &soaddr, sizeof (soaddr))); | 164 | &soaddr, sizeof (soaddr))); |
170 | ok = 0; | 165 | ok = 0; |
171 | GNUNET_SCHEDULER_add_continuation (sched, | 166 | GNUNET_SCHEDULER_add_continuation (&unload_task, |
172 | &unload_task, | ||
173 | (void *) cfg, | 167 | (void *) cfg, |
174 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 168 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
175 | } | 169 | } |
@@ -179,7 +173,6 @@ static void | |||
179 | setup_plugin_environment () | 173 | setup_plugin_environment () |
180 | { | 174 | { |
181 | env.cfg = cfg; | 175 | env.cfg = cfg; |
182 | env.sched = sched; | ||
183 | env.my_identity = &my_identity; | 176 | env.my_identity = &my_identity; |
184 | env.cls = &env; | 177 | env.cls = &env; |
185 | env.receive = &receive; | 178 | env.receive = &receive; |
@@ -192,12 +185,10 @@ setup_plugin_environment () | |||
192 | * Runs the test. | 185 | * Runs the test. |
193 | * | 186 | * |
194 | * @param cls closure | 187 | * @param cls closure |
195 | * @param s scheduler to use | ||
196 | * @param c configuration to use | 188 | * @param c configuration to use |
197 | */ | 189 | */ |
198 | static void | 190 | static void |
199 | run (void *cls, | 191 | run (void *cls, |
200 | struct GNUNET_SCHEDULER_Handle *s, | ||
201 | char *const *args, | 192 | char *const *args, |
202 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) | 193 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
203 | { | 194 | { |
@@ -205,7 +196,6 @@ run (void *cls, | |||
205 | char *keyfile; | 196 | char *keyfile; |
206 | char *libname; | 197 | char *libname; |
207 | 198 | ||
208 | sched = s; | ||
209 | cfg = c; | 199 | cfg = c; |
210 | /* parse configuration */ | 200 | /* parse configuration */ |
211 | if ((GNUNET_OK != | 201 | if ((GNUNET_OK != |
diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c index a178f16a0..7da64e295 100644 --- a/src/transport/test_plugin_transport_http.c +++ b/src/transport/test_plugin_transport_http.c | |||
@@ -232,11 +232,6 @@ static long long unsigned int port; | |||
232 | static char * test_addr; | 232 | static char * test_addr; |
233 | 233 | ||
234 | /** | 234 | /** |
235 | * Our scheduler. | ||
236 | */ | ||
237 | struct GNUNET_SCHEDULER_Handle *sched; | ||
238 | |||
239 | /** | ||
240 | * Our statistics handle. | 235 | * Our statistics handle. |
241 | */ | 236 | */ |
242 | struct GNUNET_STATISTICS_Handle *stats; | 237 | struct GNUNET_STATISTICS_Handle *stats; |
@@ -446,19 +441,19 @@ shutdown_clean () | |||
446 | 441 | ||
447 | if (ti_send != GNUNET_SCHEDULER_NO_TASK) | 442 | if (ti_send != GNUNET_SCHEDULER_NO_TASK) |
448 | { | 443 | { |
449 | GNUNET_SCHEDULER_cancel(sched,ti_send); | 444 | GNUNET_SCHEDULER_cancel(ti_send); |
450 | ti_send = GNUNET_SCHEDULER_NO_TASK; | 445 | ti_send = GNUNET_SCHEDULER_NO_TASK; |
451 | } | 446 | } |
452 | 447 | ||
453 | if (http_task_send != GNUNET_SCHEDULER_NO_TASK) | 448 | if (http_task_send != GNUNET_SCHEDULER_NO_TASK) |
454 | { | 449 | { |
455 | GNUNET_SCHEDULER_cancel(sched,http_task_send); | 450 | GNUNET_SCHEDULER_cancel(http_task_send); |
456 | http_task_send = GNUNET_SCHEDULER_NO_TASK; | 451 | http_task_send = GNUNET_SCHEDULER_NO_TASK; |
457 | } | 452 | } |
458 | 453 | ||
459 | if (ti_timeout != GNUNET_SCHEDULER_NO_TASK) | 454 | if (ti_timeout != GNUNET_SCHEDULER_NO_TASK) |
460 | { | 455 | { |
461 | GNUNET_SCHEDULER_cancel(sched,ti_timeout); | 456 | GNUNET_SCHEDULER_cancel(ti_timeout); |
462 | ti_timeout = GNUNET_SCHEDULER_NO_TASK; | 457 | ti_timeout = GNUNET_SCHEDULER_NO_TASK; |
463 | } | 458 | } |
464 | 459 | ||
@@ -466,7 +461,7 @@ shutdown_clean () | |||
466 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Unloading http plugin\n"); | 461 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Unloading http plugin\n"); |
467 | GNUNET_assert (NULL == GNUNET_PLUGIN_unload ("libgnunet_plugin_transport_http", api)); | 462 | GNUNET_assert (NULL == GNUNET_PLUGIN_unload ("libgnunet_plugin_transport_http", api)); |
468 | 463 | ||
469 | GNUNET_SCHEDULER_shutdown(sched); | 464 | GNUNET_SCHEDULER_shutdown(); |
470 | GNUNET_DISK_directory_remove ("/tmp/test_plugin_transport_http"); | 465 | GNUNET_DISK_directory_remove ("/tmp/test_plugin_transport_http"); |
471 | 466 | ||
472 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Exiting testcase\n"); | 467 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Exiting testcase\n"); |
@@ -781,8 +776,7 @@ static size_t send_prepare( struct HTTP_Transfer * result) | |||
781 | gws = GNUNET_NETWORK_fdset_create (); | 776 | gws = GNUNET_NETWORK_fdset_create (); |
782 | GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1); | 777 | GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1); |
783 | GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1); | 778 | GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1); |
784 | http_task_send = GNUNET_SCHEDULER_add_select (sched, | 779 | http_task_send = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
785 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | ||
786 | GNUNET_SCHEDULER_NO_TASK, | 780 | GNUNET_SCHEDULER_NO_TASK, |
787 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 0), | 781 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 0), |
788 | grs, | 782 | grs, |
@@ -907,7 +901,6 @@ static void | |||
907 | setup_plugin_environment () | 901 | setup_plugin_environment () |
908 | { | 902 | { |
909 | env.cfg = cfg; | 903 | env.cfg = cfg; |
910 | env.sched = sched; | ||
911 | env.stats = stats; | 904 | env.stats = stats; |
912 | env.my_identity = &my_identity; | 905 | env.my_identity = &my_identity; |
913 | env.cls = &env; | 906 | env.cls = &env; |
@@ -1123,17 +1116,14 @@ static void run_connection_tests( int phase , void * cls) | |||
1123 | * Runs the test. | 1116 | * Runs the test. |
1124 | * | 1117 | * |
1125 | * @param cls closure | 1118 | * @param cls closure |
1126 | * @param s scheduler to use | ||
1127 | * @param c configuration to use | 1119 | * @param c configuration to use |
1128 | */ | 1120 | */ |
1129 | static void | 1121 | static void |
1130 | run (void *cls, | 1122 | run (void *cls, |
1131 | struct GNUNET_SCHEDULER_Handle *s, | ||
1132 | char *const *args, | 1123 | char *const *args, |
1133 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) | 1124 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
1134 | { | 1125 | { |
1135 | char * libname; | 1126 | char * libname; |
1136 | sched = s; | ||
1137 | cfg = c; | 1127 | cfg = c; |
1138 | char *keyfile; | 1128 | char *keyfile; |
1139 | unsigned long long tneigh; | 1129 | unsigned long long tneigh; |
@@ -1223,7 +1213,7 @@ run (void *cls, | |||
1223 | } | 1213 | } |
1224 | 1214 | ||
1225 | 1215 | ||
1226 | ti_timeout = GNUNET_SCHEDULER_add_delayed (sched, TEST_TIMEOUT, &task_timeout, NULL); | 1216 | ti_timeout = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, &task_timeout, NULL); |
1227 | 1217 | ||
1228 | /* testing plugin functionality */ | 1218 | /* testing plugin functionality */ |
1229 | GNUNET_assert (0!=fail_notify_address_count); | 1219 | GNUNET_assert (0!=fail_notify_address_count); |
diff --git a/src/transport/test_plugin_transport_https.c b/src/transport/test_plugin_transport_https.c index 192ca764d..0ca13ad5c 100644 --- a/src/transport/test_plugin_transport_https.c +++ b/src/transport/test_plugin_transport_https.c | |||
@@ -231,11 +231,6 @@ static long long unsigned int port; | |||
231 | static char * test_addr; | 231 | static char * test_addr; |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * Our scheduler. | ||
235 | */ | ||
236 | struct GNUNET_SCHEDULER_Handle *sched; | ||
237 | |||
238 | /** | ||
239 | * Our statistics handle. | 234 | * Our statistics handle. |
240 | */ | 235 | */ |
241 | struct GNUNET_STATISTICS_Handle *stats; | 236 | struct GNUNET_STATISTICS_Handle *stats; |
@@ -449,19 +444,19 @@ shutdown_clean () | |||
449 | 444 | ||
450 | if (ti_send != GNUNET_SCHEDULER_NO_TASK) | 445 | if (ti_send != GNUNET_SCHEDULER_NO_TASK) |
451 | { | 446 | { |
452 | GNUNET_SCHEDULER_cancel(sched,ti_send); | 447 | GNUNET_SCHEDULER_cancel(ti_send); |
453 | ti_send = GNUNET_SCHEDULER_NO_TASK; | 448 | ti_send = GNUNET_SCHEDULER_NO_TASK; |
454 | } | 449 | } |
455 | 450 | ||
456 | if (http_task_send != GNUNET_SCHEDULER_NO_TASK) | 451 | if (http_task_send != GNUNET_SCHEDULER_NO_TASK) |
457 | { | 452 | { |
458 | GNUNET_SCHEDULER_cancel(sched,http_task_send); | 453 | GNUNET_SCHEDULER_cancel(http_task_send); |
459 | http_task_send = GNUNET_SCHEDULER_NO_TASK; | 454 | http_task_send = GNUNET_SCHEDULER_NO_TASK; |
460 | } | 455 | } |
461 | 456 | ||
462 | if (ti_timeout != GNUNET_SCHEDULER_NO_TASK) | 457 | if (ti_timeout != GNUNET_SCHEDULER_NO_TASK) |
463 | { | 458 | { |
464 | GNUNET_SCHEDULER_cancel(sched,ti_timeout); | 459 | GNUNET_SCHEDULER_cancel(ti_timeout); |
465 | ti_timeout = GNUNET_SCHEDULER_NO_TASK; | 460 | ti_timeout = GNUNET_SCHEDULER_NO_TASK; |
466 | } | 461 | } |
467 | 462 | ||
@@ -469,7 +464,7 @@ shutdown_clean () | |||
469 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Unloading https plugin\n"); | 464 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Unloading https plugin\n"); |
470 | GNUNET_assert (NULL == GNUNET_PLUGIN_unload ("libgnunet_plugin_transport_https", api)); | 465 | GNUNET_assert (NULL == GNUNET_PLUGIN_unload ("libgnunet_plugin_transport_https", api)); |
471 | 466 | ||
472 | GNUNET_SCHEDULER_shutdown(sched); | 467 | GNUNET_SCHEDULER_shutdown(); |
473 | GNUNET_DISK_directory_remove ("/tmp/test_plugin_transport_http"); | 468 | GNUNET_DISK_directory_remove ("/tmp/test_plugin_transport_http"); |
474 | 469 | ||
475 | struct stat sbuf; | 470 | struct stat sbuf; |
@@ -804,8 +799,7 @@ static size_t send_prepare( struct HTTP_Transfer * result) | |||
804 | gws = GNUNET_NETWORK_fdset_create (); | 799 | gws = GNUNET_NETWORK_fdset_create (); |
805 | GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1); | 800 | GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1); |
806 | GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1); | 801 | GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1); |
807 | http_task_send = GNUNET_SCHEDULER_add_select (sched, | 802 | http_task_send = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
808 | GNUNET_SCHEDULER_PRIORITY_DEFAULT, | ||
809 | GNUNET_SCHEDULER_NO_TASK, | 803 | GNUNET_SCHEDULER_NO_TASK, |
810 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 0), | 804 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 0), |
811 | grs, | 805 | grs, |
@@ -933,7 +927,6 @@ static void | |||
933 | setup_plugin_environment () | 927 | setup_plugin_environment () |
934 | { | 928 | { |
935 | env.cfg = cfg; | 929 | env.cfg = cfg; |
936 | env.sched = sched; | ||
937 | env.stats = stats; | 930 | env.stats = stats; |
938 | env.my_identity = &my_identity; | 931 | env.my_identity = &my_identity; |
939 | env.cls = &env; | 932 | env.cls = &env; |
@@ -1149,17 +1142,14 @@ static void run_connection_tests( int phase , void * cls) | |||
1149 | * Runs the test. | 1142 | * Runs the test. |
1150 | * | 1143 | * |
1151 | * @param cls closure | 1144 | * @param cls closure |
1152 | * @param s scheduler to use | ||
1153 | * @param c configuration to use | 1145 | * @param c configuration to use |
1154 | */ | 1146 | */ |
1155 | static void | 1147 | static void |
1156 | run (void *cls, | 1148 | run (void *cls, |
1157 | struct GNUNET_SCHEDULER_Handle *s, | ||
1158 | char *const *args, | 1149 | char *const *args, |
1159 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) | 1150 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
1160 | { | 1151 | { |
1161 | char * libname; | 1152 | char * libname; |
1162 | sched = s; | ||
1163 | cfg = c; | 1153 | cfg = c; |
1164 | char *keyfile; | 1154 | char *keyfile; |
1165 | unsigned long long tneigh; | 1155 | unsigned long long tneigh; |
@@ -1288,7 +1278,7 @@ run (void *cls, | |||
1288 | return; | 1278 | return; |
1289 | } | 1279 | } |
1290 | 1280 | ||
1291 | ti_timeout = GNUNET_SCHEDULER_add_delayed (sched, TEST_TIMEOUT, &task_timeout, NULL); | 1281 | ti_timeout = GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, &task_timeout, NULL); |
1292 | 1282 | ||
1293 | /* testing plugin functionality */ | 1283 | /* testing plugin functionality */ |
1294 | GNUNET_assert (0!=fail_notify_address_count); | 1284 | GNUNET_assert (0!=fail_notify_address_count); |
diff --git a/src/transport/test_plugin_transport_udp.c b/src/transport/test_plugin_transport_udp.c index aaa6c18d3..f297a05c1 100644 --- a/src/transport/test_plugin_transport_udp.c +++ b/src/transport/test_plugin_transport_udp.c | |||
@@ -61,11 +61,6 @@ static struct GNUNET_PeerIdentity my_identity; | |||
61 | static struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key; | 61 | static struct GNUNET_CRYPTO_RsaPrivateKey *my_private_key; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Our scheduler. | ||
65 | */ | ||
66 | struct GNUNET_SCHEDULER_Handle *sched; | ||
67 | |||
68 | /** | ||
69 | * Our configuration. | 64 | * Our configuration. |
70 | */ | 65 | */ |
71 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 66 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -162,7 +157,6 @@ static void | |||
162 | setup_plugin_environment () | 157 | setup_plugin_environment () |
163 | { | 158 | { |
164 | env.cfg = cfg; | 159 | env.cfg = cfg; |
165 | env.sched = sched; | ||
166 | env.my_identity = &my_identity; | 160 | env.my_identity = &my_identity; |
167 | env.cls = &env; | 161 | env.cls = &env; |
168 | env.receive = &receive; | 162 | env.receive = &receive; |
@@ -174,12 +168,10 @@ setup_plugin_environment () | |||
174 | * Runs the test. | 168 | * Runs the test. |
175 | * | 169 | * |
176 | * @param cls closure | 170 | * @param cls closure |
177 | * @param s scheduler to use | ||
178 | * @param c configuration to use | 171 | * @param c configuration to use |
179 | */ | 172 | */ |
180 | static void | 173 | static void |
181 | run (void *cls, | 174 | run (void *cls, |
182 | struct GNUNET_SCHEDULER_Handle *s, | ||
183 | char *const *args, | 175 | char *const *args, |
184 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) | 176 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) |
185 | { | 177 | { |
@@ -187,7 +179,6 @@ run (void *cls, | |||
187 | char *keyfile; | 179 | char *keyfile; |
188 | char *libname; | 180 | char *libname; |
189 | 181 | ||
190 | sched = s; | ||
191 | cfg = c; | 182 | cfg = c; |
192 | /* parse configuration */ | 183 | /* parse configuration */ |
193 | if ((GNUNET_OK != | 184 | if ((GNUNET_OK != |
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 77279897d..041bd0968 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c | |||
@@ -121,8 +121,6 @@ static struct PeerContext p1; | |||
121 | 121 | ||
122 | static struct PeerContext p2; | 122 | static struct PeerContext p2; |
123 | 123 | ||
124 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
125 | |||
126 | static int ok; | 124 | static int ok; |
127 | 125 | ||
128 | static int connected; | 126 | static int connected; |
@@ -165,20 +163,20 @@ end_send () | |||
165 | static void | 163 | static void |
166 | end () | 164 | end () |
167 | { | 165 | { |
168 | GNUNET_SCHEDULER_cancel (sched, die_task); | 166 | GNUNET_SCHEDULER_cancel (die_task); |
169 | die_task = GNUNET_SCHEDULER_NO_TASK; | 167 | die_task = GNUNET_SCHEDULER_NO_TASK; |
170 | 168 | ||
171 | if (measurement_task != GNUNET_SCHEDULER_NO_TASK) | 169 | if (measurement_task != GNUNET_SCHEDULER_NO_TASK) |
172 | { | 170 | { |
173 | GNUNET_SCHEDULER_cancel (sched, measurement_task); | 171 | GNUNET_SCHEDULER_cancel (measurement_task); |
174 | measurement_task = GNUNET_SCHEDULER_NO_TASK; | 172 | measurement_task = GNUNET_SCHEDULER_NO_TASK; |
175 | } | 173 | } |
176 | if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) | 174 | if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) |
177 | { | 175 | { |
178 | GNUNET_SCHEDULER_cancel (sched, measurement_counter_task); | 176 | GNUNET_SCHEDULER_cancel (measurement_counter_task); |
179 | measurement_counter_task = GNUNET_SCHEDULER_NO_TASK; | 177 | measurement_counter_task = GNUNET_SCHEDULER_NO_TASK; |
180 | } | 178 | } |
181 | GNUNET_SCHEDULER_shutdown (sched); | 179 | GNUNET_SCHEDULER_shutdown (); |
182 | #if DEBUG_CONNECTIONS | 180 | #if DEBUG_CONNECTIONS |
183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n"); | 181 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n"); |
184 | #endif | 182 | #endif |
@@ -188,7 +186,7 @@ end () | |||
188 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 186 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
189 | "Transports disconnected, returning success!\n"); | 187 | "Transports disconnected, returning success!\n"); |
190 | #endif | 188 | #endif |
191 | GNUNET_SCHEDULER_shutdown (sched); | 189 | GNUNET_SCHEDULER_shutdown (); |
192 | } | 190 | } |
193 | 191 | ||
194 | 192 | ||
@@ -213,12 +211,12 @@ end_badly (void *cls, | |||
213 | { | 211 | { |
214 | if (measurement_task != GNUNET_SCHEDULER_NO_TASK) | 212 | if (measurement_task != GNUNET_SCHEDULER_NO_TASK) |
215 | { | 213 | { |
216 | GNUNET_SCHEDULER_cancel (sched, measurement_task); | 214 | GNUNET_SCHEDULER_cancel (measurement_task); |
217 | measurement_task = GNUNET_SCHEDULER_NO_TASK; | 215 | measurement_task = GNUNET_SCHEDULER_NO_TASK; |
218 | } | 216 | } |
219 | if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) | 217 | if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) |
220 | { | 218 | { |
221 | GNUNET_SCHEDULER_cancel (sched, measurement_counter_task); | 219 | GNUNET_SCHEDULER_cancel (measurement_counter_task); |
222 | measurement_counter_task = GNUNET_SCHEDULER_NO_TASK; | 220 | measurement_counter_task = GNUNET_SCHEDULER_NO_TASK; |
223 | } | 221 | } |
224 | GNUNET_break (0); | 222 | GNUNET_break (0); |
@@ -355,8 +353,7 @@ static void measurement_counter | |||
355 | #if VERBOSE | 353 | #if VERBOSE |
356 | fprintf(stderr,"."); | 354 | fprintf(stderr,"."); |
357 | #endif | 355 | #endif |
358 | measurement_counter_task = GNUNET_SCHEDULER_add_delayed (sched, | 356 | measurement_counter_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
359 | GNUNET_TIME_UNIT_SECONDS, | ||
360 | &measurement_counter, | 357 | &measurement_counter, |
361 | NULL); | 358 | NULL); |
362 | } | 359 | } |
@@ -379,7 +376,7 @@ measurement_end (void *cls, | |||
379 | 376 | ||
380 | if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) | 377 | if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) |
381 | { | 378 | { |
382 | GNUNET_SCHEDULER_cancel (sched, measurement_counter_task); | 379 | GNUNET_SCHEDULER_cancel (measurement_counter_task); |
383 | measurement_counter_task = GNUNET_SCHEDULER_NO_TASK; | 380 | measurement_counter_task = GNUNET_SCHEDULER_NO_TASK; |
384 | } | 381 | } |
385 | #if VERBOSE | 382 | #if VERBOSE |
@@ -498,19 +495,16 @@ static void measure (unsigned long long quota_p1, unsigned long long quota_p2 ) | |||
498 | GNUNET_TIME_UNIT_FOREVER_REL, | 495 | GNUNET_TIME_UNIT_FOREVER_REL, |
499 | NULL, NULL); | 496 | NULL, NULL); |
500 | 497 | ||
501 | GNUNET_SCHEDULER_cancel (sched, die_task); | 498 | GNUNET_SCHEDULER_cancel (die_task); |
502 | die_task = GNUNET_SCHEDULER_add_delayed (sched, | 499 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
503 | TIMEOUT, | ||
504 | &end_badly, | 500 | &end_badly, |
505 | NULL); | 501 | NULL); |
506 | if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) | 502 | if (measurement_counter_task != GNUNET_SCHEDULER_NO_TASK) |
507 | GNUNET_SCHEDULER_cancel (sched, measurement_counter_task); | 503 | GNUNET_SCHEDULER_cancel (measurement_counter_task); |
508 | measurement_counter_task = GNUNET_SCHEDULER_add_delayed (sched, | 504 | measurement_counter_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
509 | GNUNET_TIME_UNIT_SECONDS, | ||
510 | &measurement_counter, | 505 | &measurement_counter, |
511 | NULL); | 506 | NULL); |
512 | measurement_task = GNUNET_SCHEDULER_add_delayed (sched, | 507 | measurement_task = GNUNET_SCHEDULER_add_delayed (MEASUREMENT_INTERVALL, |
513 | MEASUREMENT_INTERVALL, | ||
514 | &measurement_end, | 508 | &measurement_end, |
515 | NULL); | 509 | NULL); |
516 | total_bytes_sent = 0; | 510 | total_bytes_sent = 0; |
@@ -588,7 +582,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
588 | #endif | 582 | #endif |
589 | 583 | ||
590 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 584 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
591 | p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, | 585 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, |
592 | p, | 586 | p, |
593 | ¬ify_receive_new, | 587 | ¬ify_receive_new, |
594 | ¬ify_connect, | 588 | ¬ify_connect, |
@@ -634,16 +628,13 @@ exchange_hello (void *cls, | |||
634 | 628 | ||
635 | static void | 629 | static void |
636 | run (void *cls, | 630 | run (void *cls, |
637 | struct GNUNET_SCHEDULER_Handle *s, | ||
638 | char *const *args, | 631 | char *const *args, |
639 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | 632 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
640 | { | 633 | { |
641 | GNUNET_assert (ok == 1); | 634 | GNUNET_assert (ok == 1); |
642 | OKPP; | 635 | OKPP; |
643 | sched = s; | ||
644 | 636 | ||
645 | die_task = GNUNET_SCHEDULER_add_delayed (sched, | 637 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
646 | TIMEOUT, | ||
647 | &end_badly, | 638 | &end_badly, |
648 | NULL); | 639 | NULL); |
649 | measurement_running = GNUNET_NO; | 640 | measurement_running = GNUNET_NO; |
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index cee1da25b..e429ad7a7 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c | |||
@@ -68,8 +68,6 @@ static struct PeerContext p1; | |||
68 | 68 | ||
69 | static struct PeerContext p2; | 69 | static struct PeerContext p2; |
70 | 70 | ||
71 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
72 | |||
73 | static int ok; | 71 | static int ok; |
74 | 72 | ||
75 | static int is_tcp; | 73 | static int is_tcp; |
@@ -104,7 +102,7 @@ end () | |||
104 | { | 102 | { |
105 | /* do work here */ | 103 | /* do work here */ |
106 | GNUNET_assert (ok == 6); | 104 | GNUNET_assert (ok == 6); |
107 | GNUNET_SCHEDULER_cancel (sched, die_task); | 105 | GNUNET_SCHEDULER_cancel (die_task); |
108 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n"); | 106 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n"); |
109 | GNUNET_TRANSPORT_disconnect (p1.th); | 107 | GNUNET_TRANSPORT_disconnect (p1.th); |
110 | GNUNET_TRANSPORT_disconnect (p2.th); | 108 | GNUNET_TRANSPORT_disconnect (p2.th); |
@@ -193,9 +191,8 @@ notify_connect (void *cls, | |||
193 | { | 191 | { |
194 | if (cls == &p1) | 192 | if (cls == &p1) |
195 | { | 193 | { |
196 | GNUNET_SCHEDULER_cancel (sched, die_task); | 194 | GNUNET_SCHEDULER_cancel (die_task); |
197 | die_task = GNUNET_SCHEDULER_add_delayed (sched, | 195 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT_TRANSMIT, |
198 | TIMEOUT_TRANSMIT, | ||
199 | &end_badly, NULL); | 196 | &end_badly, NULL); |
200 | 197 | ||
201 | GNUNET_TRANSPORT_notify_transmit_ready (p1.th, | 198 | GNUNET_TRANSPORT_notify_transmit_ready (p1.th, |
@@ -288,7 +285,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
288 | } | 285 | } |
289 | } | 286 | } |
290 | 287 | ||
291 | p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, | 288 | p->th = GNUNET_TRANSPORT_connect (p->cfg, |
292 | NULL, p, | 289 | NULL, p, |
293 | ¬ify_receive, | 290 | ¬ify_receive, |
294 | ¬ify_connect, ¬ify_disconnect); | 291 | ¬ify_connect, ¬ify_disconnect); |
@@ -341,15 +338,12 @@ exchange_hello (void *cls, | |||
341 | 338 | ||
342 | static void | 339 | static void |
343 | run (void *cls, | 340 | run (void *cls, |
344 | struct GNUNET_SCHEDULER_Handle *s, | ||
345 | char *const *args, | 341 | char *const *args, |
346 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | 342 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
347 | { | 343 | { |
348 | GNUNET_assert (ok == 1); | 344 | GNUNET_assert (ok == 1); |
349 | OKPP; | 345 | OKPP; |
350 | sched = s; | 346 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
351 | die_task = GNUNET_SCHEDULER_add_delayed (sched, | ||
352 | TIMEOUT, | ||
353 | &end_badly, NULL); | 347 | &end_badly, NULL); |
354 | 348 | ||
355 | if (is_udp) | 349 | if (is_udp) |
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index a8633e089..ce031af7f 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -70,8 +70,6 @@ static struct PeerContext p1; | |||
70 | 70 | ||
71 | static struct PeerContext p2; | 71 | static struct PeerContext p2; |
72 | 72 | ||
73 | static struct GNUNET_SCHEDULER_Handle *sched; | ||
74 | |||
75 | static int ok; | 73 | static int ok; |
76 | 74 | ||
77 | static int is_tcp; | 75 | static int is_tcp; |
@@ -116,7 +114,7 @@ end () | |||
116 | { | 114 | { |
117 | unsigned long long delta; | 115 | unsigned long long delta; |
118 | 116 | ||
119 | GNUNET_SCHEDULER_cancel (sched, die_task); | 117 | GNUNET_SCHEDULER_cancel (die_task); |
120 | die_task = GNUNET_SCHEDULER_NO_TASK; | 118 | die_task = GNUNET_SCHEDULER_NO_TASK; |
121 | #if VERBOSE | 119 | #if VERBOSE |
122 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n"); | 120 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from transports!\n"); |
@@ -208,8 +206,8 @@ notify_receive (void *cls, | |||
208 | n, s, | 206 | n, s, |
209 | ntohs (message->size), | 207 | ntohs (message->size), |
210 | ntohl (hdr->num)); | 208 | ntohl (hdr->num)); |
211 | GNUNET_SCHEDULER_cancel (sched, die_task); | 209 | GNUNET_SCHEDULER_cancel (die_task); |
212 | die_task = GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL); | 210 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
213 | return; | 211 | return; |
214 | } | 212 | } |
215 | if (ntohl (hdr->num) != n) | 213 | if (ntohl (hdr->num) != n) |
@@ -219,8 +217,8 @@ notify_receive (void *cls, | |||
219 | n, s, | 217 | n, s, |
220 | ntohs (message->size), | 218 | ntohs (message->size), |
221 | ntohl (hdr->num)); | 219 | ntohl (hdr->num)); |
222 | GNUNET_SCHEDULER_cancel (sched, die_task); | 220 | GNUNET_SCHEDULER_cancel (die_task); |
223 | die_task = GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL); | 221 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
224 | return; | 222 | return; |
225 | } | 223 | } |
226 | memset (cbuf, n, s - sizeof (struct TestMessage)); | 224 | memset (cbuf, n, s - sizeof (struct TestMessage)); |
@@ -231,8 +229,8 @@ notify_receive (void *cls, | |||
231 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 229 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
232 | "Expected message %u with bits %u, but body did not match\n", | 230 | "Expected message %u with bits %u, but body did not match\n", |
233 | n, (unsigned char) n); | 231 | n, (unsigned char) n); |
234 | GNUNET_SCHEDULER_cancel (sched, die_task); | 232 | GNUNET_SCHEDULER_cancel (die_task); |
235 | die_task = GNUNET_SCHEDULER_add_now (sched, &end_badly, NULL); | 233 | die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
236 | return; | 234 | return; |
237 | } | 235 | } |
238 | #if VERBOSE | 236 | #if VERBOSE |
@@ -248,9 +246,8 @@ notify_receive (void *cls, | |||
248 | if (0 == (n % (TOTAL_MSGS/100))) | 246 | if (0 == (n % (TOTAL_MSGS/100))) |
249 | { | 247 | { |
250 | fprintf (stderr, "."); | 248 | fprintf (stderr, "."); |
251 | GNUNET_SCHEDULER_cancel (sched, die_task); | 249 | GNUNET_SCHEDULER_cancel (die_task); |
252 | die_task = GNUNET_SCHEDULER_add_delayed (sched, | 250 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
253 | TIMEOUT, | ||
254 | &end_badly, | 251 | &end_badly, |
255 | NULL); | 252 | NULL); |
256 | } | 253 | } |
@@ -450,7 +447,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
450 | } | 447 | } |
451 | } | 448 | } |
452 | 449 | ||
453 | p->th = GNUNET_TRANSPORT_connect (sched, p->cfg, NULL, | 450 | p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, |
454 | p, | 451 | p, |
455 | ¬ify_receive, | 452 | ¬ify_receive, |
456 | ¬ify_connect, | 453 | ¬ify_connect, |
@@ -622,15 +619,12 @@ check_gnunet_nat_binary(char *binary) | |||
622 | 619 | ||
623 | static void | 620 | static void |
624 | run (void *cls, | 621 | run (void *cls, |
625 | struct GNUNET_SCHEDULER_Handle *s, | ||
626 | char *const *args, | 622 | char *const *args, |
627 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | 623 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
628 | { | 624 | { |
629 | GNUNET_assert (ok == 1); | 625 | GNUNET_assert (ok == 1); |
630 | OKPP; | 626 | OKPP; |
631 | sched = s; | 627 | die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
632 | die_task = GNUNET_SCHEDULER_add_delayed (sched, | ||
633 | TIMEOUT, | ||
634 | &end_badly, | 628 | &end_badly, |
635 | NULL); | 629 | NULL); |
636 | if (is_tcp) | 630 | if (is_tcp) |
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index c0f32f93d..6fb35b5d6 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -327,11 +327,6 @@ struct GNUNET_TRANSPORT_Handle | |||
327 | struct HelloWaitList *hwl_head; | 327 | struct HelloWaitList *hwl_head; |
328 | 328 | ||
329 | /** | 329 | /** |
330 | * My scheduler. | ||
331 | */ | ||
332 | struct GNUNET_SCHEDULER_Handle *sched; | ||
333 | |||
334 | /** | ||
335 | * My configuration. | 330 | * My configuration. |
336 | */ | 331 | */ |
337 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 332 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -444,8 +439,7 @@ schedule_peer_transmission (struct GNUNET_TRANSPORT_Handle *h) | |||
444 | 439 | ||
445 | if (h->quota_task != GNUNET_SCHEDULER_NO_TASK) | 440 | if (h->quota_task != GNUNET_SCHEDULER_NO_TASK) |
446 | { | 441 | { |
447 | GNUNET_SCHEDULER_cancel (h->sched, | 442 | GNUNET_SCHEDULER_cancel (h->quota_task); |
448 | h->quota_task); | ||
449 | h->quota_task = GNUNET_SCHEDULER_NO_TASK; | 443 | h->quota_task = GNUNET_SCHEDULER_NO_TASK; |
450 | } | 444 | } |
451 | retry_time = GNUNET_TIME_UNIT_FOREVER_REL; | 445 | retry_time = GNUNET_TIME_UNIT_FOREVER_REL; |
@@ -476,7 +470,7 @@ schedule_peer_transmission (struct GNUNET_TRANSPORT_Handle *h) | |||
476 | #endif | 470 | #endif |
477 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) | 471 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) |
478 | { | 472 | { |
479 | GNUNET_SCHEDULER_cancel (h->sched, th->notify_delay_task); | 473 | GNUNET_SCHEDULER_cancel (th->notify_delay_task); |
480 | th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; | 474 | th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; |
481 | } | 475 | } |
482 | n->transmit_stage = TS_NEW; | 476 | n->transmit_stage = TS_NEW; |
@@ -510,8 +504,7 @@ schedule_peer_transmission (struct GNUNET_TRANSPORT_Handle *h) | |||
510 | ret = th; | 504 | ret = th; |
511 | } | 505 | } |
512 | if (ret == NULL) | 506 | if (ret == NULL) |
513 | h->quota_task = GNUNET_SCHEDULER_add_delayed (h->sched, | 507 | h->quota_task = GNUNET_SCHEDULER_add_delayed (retry_time, |
514 | retry_time, | ||
515 | "a_transmit_ready, | 508 | "a_transmit_ready, |
516 | h); | 509 | h); |
517 | return ret; | 510 | return ret; |
@@ -556,7 +549,7 @@ transport_notify_ready (void *cls, size_t size, void *buf) | |||
556 | { | 549 | { |
557 | if (cm->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) | 550 | if (cm->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) |
558 | { | 551 | { |
559 | GNUNET_SCHEDULER_cancel (h->sched, cm->notify_delay_task); | 552 | GNUNET_SCHEDULER_cancel (cm->notify_delay_task); |
560 | cm->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; | 553 | cm->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; |
561 | } | 554 | } |
562 | GNUNET_CONTAINER_DLL_remove (h->control_head, | 555 | GNUNET_CONTAINER_DLL_remove (h->control_head, |
@@ -578,7 +571,7 @@ transport_notify_ready (void *cls, size_t size, void *buf) | |||
578 | { | 571 | { |
579 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) | 572 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) |
580 | { | 573 | { |
581 | GNUNET_SCHEDULER_cancel (h->sched, th->notify_delay_task); | 574 | GNUNET_SCHEDULER_cancel (th->notify_delay_task); |
582 | th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; | 575 | th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; |
583 | } | 576 | } |
584 | n = th->neighbour; | 577 | n = th->neighbour; |
@@ -763,8 +756,7 @@ schedule_control_transmit (struct GNUNET_TRANSPORT_Handle *h, | |||
763 | th->notify_cls = notify_cls; | 756 | th->notify_cls = notify_cls; |
764 | th->notify_size = size; | 757 | th->notify_size = size; |
765 | th->notify_delay_task | 758 | th->notify_delay_task |
766 | = GNUNET_SCHEDULER_add_delayed (h->sched, | 759 | = GNUNET_SCHEDULER_add_delayed (timeout, &control_transmit_timeout, th); |
767 | timeout, &control_transmit_timeout, th); | ||
768 | if (at_head) | 760 | if (at_head) |
769 | GNUNET_CONTAINER_DLL_insert (h->control_head, | 761 | GNUNET_CONTAINER_DLL_insert (h->control_head, |
770 | h->control_tail, | 762 | h->control_tail, |
@@ -810,8 +802,7 @@ send_set_quota (void *cls, size_t size, void *buf) | |||
810 | 802 | ||
811 | if (buf == NULL) | 803 | if (buf == NULL) |
812 | { | 804 | { |
813 | GNUNET_SCHEDULER_add_continuation (sqc->handle->sched, | 805 | GNUNET_SCHEDULER_add_continuation (sqc->cont, |
814 | sqc->cont, | ||
815 | sqc->cont_cls, | 806 | sqc->cont_cls, |
816 | GNUNET_SCHEDULER_REASON_TIMEOUT); | 807 | GNUNET_SCHEDULER_REASON_TIMEOUT); |
817 | GNUNET_free (sqc); | 808 | GNUNET_free (sqc); |
@@ -830,8 +821,7 @@ send_set_quota (void *cls, size_t size, void *buf) | |||
830 | msg->quota = sqc->quota_in; | 821 | msg->quota = sqc->quota_in; |
831 | memcpy (&msg->peer, &sqc->target, sizeof (struct GNUNET_PeerIdentity)); | 822 | memcpy (&msg->peer, &sqc->target, sizeof (struct GNUNET_PeerIdentity)); |
832 | if (sqc->cont != NULL) | 823 | if (sqc->cont != NULL) |
833 | GNUNET_SCHEDULER_add_continuation (sqc->handle->sched, | 824 | GNUNET_SCHEDULER_add_continuation (sqc->cont, |
834 | sqc->cont, | ||
835 | sqc->cont_cls, | 825 | sqc->cont_cls, |
836 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 826 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
837 | GNUNET_free (sqc); | 827 | GNUNET_free (sqc); |
@@ -1192,7 +1182,7 @@ reconnect (void *cls, | |||
1192 | "Connecting to transport service.\n"); | 1182 | "Connecting to transport service.\n"); |
1193 | #endif | 1183 | #endif |
1194 | GNUNET_assert (h->client == NULL); | 1184 | GNUNET_assert (h->client == NULL); |
1195 | h->client = GNUNET_CLIENT_connect (h->sched, "transport", h->cfg); | 1185 | h->client = GNUNET_CLIENT_connect ("transport", h->cfg); |
1196 | GNUNET_assert (h->client != NULL); | 1186 | GNUNET_assert (h->client != NULL); |
1197 | /* make sure we don't send "START" twice, remove existing entry from | 1187 | /* make sure we don't send "START" twice, remove existing entry from |
1198 | queue (if present) */ | 1188 | queue (if present) */ |
@@ -1206,7 +1196,7 @@ reconnect (void *cls, | |||
1206 | pos); | 1196 | pos); |
1207 | if (GNUNET_SCHEDULER_NO_TASK != pos->notify_delay_task) | 1197 | if (GNUNET_SCHEDULER_NO_TASK != pos->notify_delay_task) |
1208 | { | 1198 | { |
1209 | GNUNET_SCHEDULER_cancel (h->sched, pos->notify_delay_task); | 1199 | GNUNET_SCHEDULER_cancel (pos->notify_delay_task); |
1210 | pos->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; | 1200 | pos->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; |
1211 | } | 1201 | } |
1212 | GNUNET_free (pos); | 1202 | GNUNET_free (pos); |
@@ -1240,8 +1230,7 @@ schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h) | |||
1240 | GNUNET_assert (h->client == NULL); | 1230 | GNUNET_assert (h->client == NULL); |
1241 | GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK); | 1231 | GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK); |
1242 | h->reconnect_task | 1232 | h->reconnect_task |
1243 | = GNUNET_SCHEDULER_add_delayed (h->sched, | 1233 | = GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); |
1244 | h->reconnect_delay, &reconnect, h); | ||
1245 | if (h->reconnect_delay.rel_value == 0) | 1234 | if (h->reconnect_delay.rel_value == 0) |
1246 | { | 1235 | { |
1247 | h->reconnect_delay = GNUNET_TIME_UNIT_MILLISECONDS; | 1236 | h->reconnect_delay = GNUNET_TIME_UNIT_MILLISECONDS; |
@@ -1353,7 +1342,6 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h, | |||
1353 | * Connect to the transport service. Note that the connection may | 1342 | * Connect to the transport service. Note that the connection may |
1354 | * complete (or fail) asynchronously. | 1343 | * complete (or fail) asynchronously. |
1355 | * | 1344 | * |
1356 | * @param sched scheduler to use | ||
1357 | * @param cfg configuration to use | 1345 | * @param cfg configuration to use |
1358 | * @param self our own identity (API should check that it matches | 1346 | * @param self our own identity (API should check that it matches |
1359 | * the identity found by transport), or NULL (no check) | 1347 | * the identity found by transport), or NULL (no check) |
@@ -1363,8 +1351,7 @@ neighbour_add (struct GNUNET_TRANSPORT_Handle *h, | |||
1363 | * @param nd function to call on disconnect events | 1351 | * @param nd function to call on disconnect events |
1364 | */ | 1352 | */ |
1365 | struct GNUNET_TRANSPORT_Handle * | 1353 | struct GNUNET_TRANSPORT_Handle * |
1366 | GNUNET_TRANSPORT_connect (struct GNUNET_SCHEDULER_Handle *sched, | 1354 | GNUNET_TRANSPORT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1367 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
1368 | const struct GNUNET_PeerIdentity *self, | 1355 | const struct GNUNET_PeerIdentity *self, |
1369 | void *cls, | 1356 | void *cls, |
1370 | GNUNET_TRANSPORT_ReceiveCallback rec, | 1357 | GNUNET_TRANSPORT_ReceiveCallback rec, |
@@ -1379,7 +1366,6 @@ GNUNET_TRANSPORT_connect (struct GNUNET_SCHEDULER_Handle *sched, | |||
1379 | ret->self = *self; | 1366 | ret->self = *self; |
1380 | ret->check_self = GNUNET_YES; | 1367 | ret->check_self = GNUNET_YES; |
1381 | } | 1368 | } |
1382 | ret->sched = sched; | ||
1383 | ret->cfg = cfg; | 1369 | ret->cfg = cfg; |
1384 | ret->cls = cls; | 1370 | ret->cls = cls; |
1385 | ret->rec = rec; | 1371 | ret->rec = rec; |
@@ -1421,8 +1407,7 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) | |||
1421 | th = &n->transmit_handle; | 1407 | th = &n->transmit_handle; |
1422 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) | 1408 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) |
1423 | { | 1409 | { |
1424 | GNUNET_SCHEDULER_cancel (handle->sched, | 1410 | GNUNET_SCHEDULER_cancel (th->notify_delay_task); |
1425 | th->notify_delay_task); | ||
1426 | th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; | 1411 | th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; |
1427 | } | 1412 | } |
1428 | GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); | 1413 | GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); |
@@ -1454,7 +1439,7 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) | |||
1454 | #endif | 1439 | #endif |
1455 | if (cm->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) | 1440 | if (cm->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) |
1456 | { | 1441 | { |
1457 | GNUNET_SCHEDULER_cancel (handle->sched, cm->notify_delay_task); | 1442 | GNUNET_SCHEDULER_cancel (cm->notify_delay_task); |
1458 | cm->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; | 1443 | cm->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; |
1459 | } | 1444 | } |
1460 | GNUNET_CONTAINER_DLL_remove (handle->control_head, | 1445 | GNUNET_CONTAINER_DLL_remove (handle->control_head, |
@@ -1466,12 +1451,12 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) | |||
1466 | 1451 | ||
1467 | if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK) | 1452 | if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK) |
1468 | { | 1453 | { |
1469 | GNUNET_SCHEDULER_cancel (handle->sched, handle->reconnect_task); | 1454 | GNUNET_SCHEDULER_cancel (handle->reconnect_task); |
1470 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; | 1455 | handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; |
1471 | } | 1456 | } |
1472 | if (handle->quota_task != GNUNET_SCHEDULER_NO_TASK) | 1457 | if (handle->quota_task != GNUNET_SCHEDULER_NO_TASK) |
1473 | { | 1458 | { |
1474 | GNUNET_SCHEDULER_cancel (handle->sched, handle->quota_task); | 1459 | GNUNET_SCHEDULER_cancel (handle->quota_task); |
1475 | handle->quota_task = GNUNET_SCHEDULER_NO_TASK; | 1460 | handle->quota_task = GNUNET_SCHEDULER_NO_TASK; |
1476 | } | 1461 | } |
1477 | GNUNET_free_non_null (handle->my_hello); | 1462 | GNUNET_free_non_null (handle->my_hello); |
@@ -1857,7 +1842,7 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle | |||
1857 | th->notify_size = size + sizeof (struct OutboundMessage); | 1842 | th->notify_size = size + sizeof (struct OutboundMessage); |
1858 | th->priority = priority; | 1843 | th->priority = priority; |
1859 | th->notify_delay_task | 1844 | th->notify_delay_task |
1860 | = GNUNET_SCHEDULER_add_delayed (handle->sched, timeout, | 1845 | = GNUNET_SCHEDULER_add_delayed (timeout, |
1861 | &peer_transmit_timeout, th); | 1846 | &peer_transmit_timeout, th); |
1862 | schedule_transmission (handle); | 1847 | schedule_transmission (handle); |
1863 | return th; | 1848 | return th; |
@@ -1902,8 +1887,7 @@ GNUNET_TRANSPORT_notify_transmit_ready_cancel (struct | |||
1902 | } | 1887 | } |
1903 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) | 1888 | if (th->notify_delay_task != GNUNET_SCHEDULER_NO_TASK) |
1904 | { | 1889 | { |
1905 | GNUNET_SCHEDULER_cancel (n->h->sched, | 1890 | GNUNET_SCHEDULER_cancel (th->notify_delay_task); |
1906 | th->notify_delay_task); | ||
1907 | th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; | 1891 | th->notify_delay_task = GNUNET_SCHEDULER_NO_TASK; |
1908 | } | 1892 | } |
1909 | } | 1893 | } |
diff --git a/src/transport/transport_api_address_lookup.c b/src/transport/transport_api_address_lookup.c index cb15f0565..022d5f03b 100644 --- a/src/transport/transport_api_address_lookup.c +++ b/src/transport/transport_api_address_lookup.c | |||
@@ -108,7 +108,6 @@ address_response_processor (void *cls, | |||
108 | /** | 108 | /** |
109 | * Convert a binary address into a human readable address. | 109 | * Convert a binary address into a human readable address. |
110 | * | 110 | * |
111 | * @param sched scheduler to use | ||
112 | * @param cfg configuration to use | 111 | * @param cfg configuration to use |
113 | * @param address address to convert (binary format) | 112 | * @param address address to convert (binary format) |
114 | * @param addressLen number of bytes in address | 113 | * @param addressLen number of bytes in address |
@@ -120,8 +119,7 @@ address_response_processor (void *cls, | |||
120 | * @param aluc_cls closure for aluc | 119 | * @param aluc_cls closure for aluc |
121 | */ | 120 | */ |
122 | void | 121 | void |
123 | GNUNET_TRANSPORT_address_lookup (struct GNUNET_SCHEDULER_Handle *sched, | 122 | GNUNET_TRANSPORT_address_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg, |
124 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
125 | const char *address, | 123 | const char *address, |
126 | size_t addressLen, | 124 | size_t addressLen, |
127 | int numeric, | 125 | int numeric, |
@@ -146,7 +144,7 @@ GNUNET_TRANSPORT_address_lookup (struct GNUNET_SCHEDULER_Handle *sched, | |||
146 | aluc (aluc_cls, NULL); | 144 | aluc (aluc_cls, NULL); |
147 | return; | 145 | return; |
148 | } | 146 | } |
149 | client = GNUNET_CLIENT_connect (sched, "transport", cfg); | 147 | client = GNUNET_CLIENT_connect ("transport", cfg); |
150 | if (client == NULL) | 148 | if (client == NULL) |
151 | { | 149 | { |
152 | aluc (aluc_cls, NULL); | 150 | aluc (aluc_cls, NULL); |
diff --git a/src/transport/transport_api_blacklist.c b/src/transport/transport_api_blacklist.c index 1025edef4..2315b515f 100644 --- a/src/transport/transport_api_blacklist.c +++ b/src/transport/transport_api_blacklist.c | |||
@@ -45,11 +45,6 @@ struct GNUNET_TRANSPORT_Blacklist | |||
45 | struct GNUNET_CLIENT_Connection * client; | 45 | struct GNUNET_CLIENT_Connection * client; |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Scheduler to use. | ||
49 | */ | ||
50 | struct GNUNET_SCHEDULER_Handle *sched; | ||
51 | |||
52 | /** | ||
53 | * Configuration to use. | 48 | * Configuration to use. |
54 | */ | 49 | */ |
55 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 50 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -175,8 +170,7 @@ reconnect (struct GNUNET_TRANSPORT_Blacklist *br) | |||
175 | { | 170 | { |
176 | if (br->client != NULL) | 171 | if (br->client != NULL) |
177 | GNUNET_CLIENT_disconnect (br->client, GNUNET_NO); | 172 | GNUNET_CLIENT_disconnect (br->client, GNUNET_NO); |
178 | br->client = GNUNET_CLIENT_connect (br->sched, | 173 | br->client = GNUNET_CLIENT_connect ("transport", |
179 | "transport", | ||
180 | br->cfg); | 174 | br->cfg); |
181 | GNUNET_assert (br->client != NULL); | 175 | GNUNET_assert (br->client != NULL); |
182 | br->th = GNUNET_CLIENT_notify_transmit_ready (br->client, | 176 | br->th = GNUNET_CLIENT_notify_transmit_ready (br->client, |
@@ -249,27 +243,24 @@ reply (struct GNUNET_TRANSPORT_Blacklist *br) | |||
249 | * only way to re-enable connections from peers that were previously | 243 | * only way to re-enable connections from peers that were previously |
250 | * blacklisted. | 244 | * blacklisted. |
251 | * | 245 | * |
252 | * @param sched scheduler to use | ||
253 | * @param cfg configuration to use | 246 | * @param cfg configuration to use |
254 | * @param cb callback to invoke to check if connections are allowed | 247 | * @param cb callback to invoke to check if connections are allowed |
255 | * @param cb_cls closure for cb | 248 | * @param cb_cls closure for cb |
256 | * @return NULL on error, otherwise handle for cancellation | 249 | * @return NULL on error, otherwise handle for cancellation |
257 | */ | 250 | */ |
258 | struct GNUNET_TRANSPORT_Blacklist * | 251 | struct GNUNET_TRANSPORT_Blacklist * |
259 | GNUNET_TRANSPORT_blacklist (struct GNUNET_SCHEDULER_Handle *sched, | 252 | GNUNET_TRANSPORT_blacklist (const struct GNUNET_CONFIGURATION_Handle *cfg, |
260 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
261 | GNUNET_TRANSPORT_BlacklistCallback cb, | 253 | GNUNET_TRANSPORT_BlacklistCallback cb, |
262 | void *cb_cls) | 254 | void *cb_cls) |
263 | { | 255 | { |
264 | struct GNUNET_CLIENT_Connection * client; | 256 | struct GNUNET_CLIENT_Connection * client; |
265 | struct GNUNET_TRANSPORT_Blacklist *ret; | 257 | struct GNUNET_TRANSPORT_Blacklist *ret; |
266 | 258 | ||
267 | client = GNUNET_CLIENT_connect (sched, "transport", cfg); | 259 | client = GNUNET_CLIENT_connect ("transport", cfg); |
268 | if (NULL == client) | 260 | if (NULL == client) |
269 | return NULL; | 261 | return NULL; |
270 | ret = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_Blacklist)); | 262 | ret = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_Blacklist)); |
271 | ret->client = client; | 263 | ret->client = client; |
272 | ret->sched = sched; | ||
273 | ret->cfg = cfg; | 264 | ret->cfg = cfg; |
274 | ret->th = GNUNET_CLIENT_notify_transmit_ready (client, | 265 | ret->th = GNUNET_CLIENT_notify_transmit_ready (client, |
275 | sizeof (struct GNUNET_MessageHeader), | 266 | sizeof (struct GNUNET_MessageHeader), |