diff options
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 37 |
1 files changed, 13 insertions, 24 deletions
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, |