aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r--src/transport/plugin_transport_udp.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 3a482c486..0589a24bd 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1687,9 +1687,11 @@ udp_plugin_lookup_session (void *cls,
1687 "Looking for existing session for peer `%s' `%s' \n", 1687 "Looking for existing session for peer `%s' `%s' \n",
1688 GNUNET_i2s (&address->peer), 1688 GNUNET_i2s (&address->peer),
1689 udp_address_to_string(NULL, address->address, address->address_length)); 1689 udp_address_to_string(NULL, address->address, address->address_length));
1690 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions, &address->peer, 1690 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions,
1691 session_cmp_it, &cctx); 1691 &address->peer,
1692 if (cctx.res != NULL ) 1692 session_cmp_it,
1693 &cctx);
1694 if (NULL != cctx.res)
1693 { 1695 {
1694 LOG (GNUNET_ERROR_TYPE_DEBUG, 1696 LOG (GNUNET_ERROR_TYPE_DEBUG,
1695 "Found existing session %p\n", 1697 "Found existing session %p\n",
@@ -1836,14 +1838,18 @@ udp_plugin_create_session (void *cls,
1836 if (NULL == s) 1838 if (NULL == s)
1837 return NULL; /* protocol not supported or address invalid */ 1839 return NULL; /* protocol not supported or address invalid */
1838 LOG(GNUNET_ERROR_TYPE_DEBUG, 1840 LOG(GNUNET_ERROR_TYPE_DEBUG,
1839 "Creating new %s session %p for peer `%s' address `%s'\n", 1841 "Creating new session %p for peer `%s' address `%s'\n",
1840 GNUNET_HELLO_address_check_option (address, GNUNET_HELLO_ADDRESS_INFO_INBOUND) ? "inbound" : "outbound",
1841 s, GNUNET_i2s (&address->peer), 1842 s, GNUNET_i2s (&address->peer),
1842 udp_address_to_string( NULL,address->address,address->address_length)); 1843 udp_address_to_string( NULL,address->address,address->address_length));
1843 GNUNET_assert( 1844 GNUNET_assert(GNUNET_OK ==
1844 GNUNET_OK == GNUNET_CONTAINER_multipeermap_put (plugin->sessions, &s->target, s, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); 1845 GNUNET_CONTAINER_multipeermap_put (plugin->sessions,
1845 GNUNET_STATISTICS_set (plugin->env->stats, "# UDP sessions active", 1846 &s->target,
1846 GNUNET_CONTAINER_multipeermap_size (plugin->sessions), GNUNET_NO); 1847 s,
1848 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
1849 GNUNET_STATISTICS_set (plugin->env->stats,
1850 "# UDP sessions active",
1851 GNUNET_CONTAINER_multipeermap_size (plugin->sessions),
1852 GNUNET_NO);
1847 return s; 1853 return s;
1848} 1854}
1849 1855
@@ -2330,18 +2336,19 @@ process_udp_message (struct Plugin *plugin,
2330 GNUNET_break(0); 2336 GNUNET_break(0);
2331 return; 2337 return;
2332 } 2338 }
2333 LOG(GNUNET_ERROR_TYPE_DEBUG, 2339 LOG (GNUNET_ERROR_TYPE_DEBUG,
2334 "Received message with %u bytes from peer `%s' at `%s'\n", 2340 "Received message with %u bytes from peer `%s' at `%s'\n",
2335 (unsigned int ) ntohs (msg->header.size), GNUNET_i2s (&msg->sender), 2341 (unsigned int ) ntohs (msg->header.size), GNUNET_i2s (&msg->sender),
2336 GNUNET_a2s (sender_addr, sender_addr_len)); 2342 GNUNET_a2s (sender_addr, sender_addr_len));
2337 2343
2338 address = GNUNET_HELLO_address_allocate ( &msg->sender, PLUGIN_NAME, 2344 address = GNUNET_HELLO_address_allocate (&msg->sender, PLUGIN_NAME,
2339 arg, args, 2345 arg, args,
2340 GNUNET_HELLO_ADDRESS_INFO_INBOUND); 2346 GNUNET_HELLO_ADDRESS_INFO_NONE);
2341 if (NULL == (s = udp_plugin_lookup_session (plugin, address))) 2347 if (NULL == (s = udp_plugin_lookup_session (plugin, address)))
2342 { 2348 {
2343 s = udp_plugin_create_session (plugin, address); 2349 s = udp_plugin_create_session (plugin, address);
2344 plugin->env->session_start (NULL, address, s, NULL, 0); 2350 plugin->env->session_start (plugin->env->cls,
2351 address, s, NULL, 0);
2345 notify_session_monitor (s->plugin, 2352 notify_session_monitor (s->plugin,
2346 s, 2353 s,
2347 GNUNET_TRANSPORT_SS_INIT); 2354 GNUNET_TRANSPORT_SS_INIT);