aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r--src/transport/plugin_transport_tcp.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 770525f21..01a4eade8 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -2261,9 +2261,8 @@ handle_tcp_welcome (void *cls,
2261 struct GNUNET_ATS_Information ats; 2261 struct GNUNET_ATS_Information ats;
2262 2262
2263 2263
2264 if (0 == memcmp (&wm->clientIdentity, 2264 if (0 == memcmp (&wm->clientIdentity, plugin->env->my_identity,
2265 plugin->env->my_identity, 2265 sizeof(struct GNUNET_PeerIdentity)))
2266 sizeof(struct GNUNET_PeerIdentity)))
2267 { 2266 {
2268 /* refuse connections from ourselves */ 2267 /* refuse connections from ourselves */
2269 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 2268 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -2278,14 +2277,10 @@ handle_tcp_welcome (void *cls,
2278 return; 2277 return;
2279 } 2278 }
2280 2279
2281 LOG(GNUNET_ERROR_TYPE_DEBUG, 2280 LOG(GNUNET_ERROR_TYPE_DEBUG, "Received %s message from `%4s' %p\n", "WELCOME",
2282 "Received %s message from `%4s' %p\n",
2283 "WELCOME",
2284 GNUNET_i2s (&wm->clientIdentity), client); 2281 GNUNET_i2s (&wm->clientIdentity), client);
2285 GNUNET_STATISTICS_update (plugin->env->stats, 2282 GNUNET_STATISTICS_update (plugin->env->stats,
2286 gettext_noop ("# TCP WELCOME messages received"), 2283 gettext_noop ("# TCP WELCOME messages received"), 1, GNUNET_NO);
2287 1,
2288 GNUNET_NO);
2289 session = lookup_session_by_client (plugin, client); 2284 session = lookup_session_by_client (plugin, client);
2290 if (NULL != session) 2285 if (NULL != session)
2291 { 2286 {
@@ -2293,9 +2288,8 @@ handle_tcp_welcome (void *cls,
2293 { 2288 {
2294 LOG (GNUNET_ERROR_TYPE_DEBUG, 2289 LOG (GNUNET_ERROR_TYPE_DEBUG,
2295 "Found existing session %p for peer `%s'\n", 2290 "Found existing session %p for peer `%s'\n",
2296 session, 2291 session, GNUNET_a2s (vaddr, alen));
2297 GNUNET_a2s (vaddr, alen)); 2292 GNUNET_free(vaddr);
2298 GNUNET_free (vaddr);
2299 } 2293 }
2300 } 2294 }
2301 else 2295 else
@@ -2343,27 +2337,23 @@ handle_tcp_welcome (void *cls,
2343 session->ats_address_network_type = plugin->env->get_address_type (plugin->env->cls, vaddr, alen); 2337 session->ats_address_network_type = plugin->env->get_address_type (plugin->env->cls, vaddr, alen);
2344 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE); 2338 ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
2345 ats.value = htonl (session->ats_address_network_type); 2339 ats.value = htonl (session->ats_address_network_type);
2346 LOG (GNUNET_ERROR_TYPE_DEBUG, 2340 LOG(GNUNET_ERROR_TYPE_DEBUG,
2347 "Creating new%s session %p for peer `%s' client %p \n", 2341 "Creating new%s session %p for peer `%s' client %p \n",
2348 GNUNET_HELLO_address_check_option (session->address, 2342 GNUNET_HELLO_address_check_option (session->address,
2349 GNUNET_HELLO_ADDRESS_INFO_INBOUND) 2343 GNUNET_HELLO_ADDRESS_INFO_INBOUND)
2350 ? " inbound" : "", 2344 ? " inbound" : "",
2351 session, 2345 session,
2352 tcp_plugin_address_to_string (NULL, 2346 tcp_plugin_address_to_string(NULL, (void *) session->address->address,
2353 (void *) session->address->address, 2347 session->address->address_length),
2354 session->address->address_length), 2348 client);
2355 client); 2349 GNUNET_free(vaddr);
2356 GNUNET_free (vaddr); 2350 GNUNET_SERVER_client_set_user_context(session->client, session);
2357 GNUNET_SERVER_client_set_user_context (session->client, session);
2358 GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap, 2351 GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
2359 &session->target, 2352 &session->target,
2360 session, 2353 session,
2361 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 2354 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2362 /* Notify transport and ATS about new session */ 2355 /* Notify transport and ATS about new session */
2363 plugin->env->session_start (plugin->env->cls, 2356 plugin->env->session_start (NULL, session->address, session, &ats, 1);
2364 session->address,
2365 session,
2366 &ats, 1);
2367 notify_session_monitor (plugin, 2357 notify_session_monitor (plugin,
2368 session, 2358 session,
2369 GNUNET_TRANSPORT_SS_INIT); 2359 GNUNET_TRANSPORT_SS_INIT);