aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-30 20:35:10 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-30 20:35:10 +0000
commita0ba5b741b56036bd35bd9ba88164324b2ff7ada (patch)
tree3fd10a0fc15f9a9e7cf5415b2bec86d97d7fe825 /src/transport/plugin_transport_udp.c
parent427dd6f998fb1fde515a3b5c800f9f6d308197b2 (diff)
downloadgnunet-a0ba5b741b56036bd35bd9ba88164324b2ff7ada.tar.gz
gnunet-a0ba5b741b56036bd35bd9ba88164324b2ff7ada.zip
-getting ATS and transport to compile again (part of #3047)
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r--src/transport/plugin_transport_udp.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index bc64fd5d2..4fe4d94cf 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1271,12 +1271,12 @@ disconnect_session (struct Session *s)
1271 } 1271 }
1272 1272
1273 GNUNET_assert (GNUNET_YES == 1273 GNUNET_assert (GNUNET_YES ==
1274 GNUNET_CONTAINER_multihashmap_remove (plugin->sessions, 1274 GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
1275 &s->target.hashPubKey, 1275 &s->target,
1276 s)); 1276 s));
1277 GNUNET_STATISTICS_set(plugin->env->stats, 1277 GNUNET_STATISTICS_set(plugin->env->stats,
1278 "# UDP, sessions active", 1278 "# UDP, sessions active",
1279 GNUNET_CONTAINER_multihashmap_size(plugin->sessions), 1279 GNUNET_CONTAINER_multipeermap_size(plugin->sessions),
1280 GNUNET_NO); 1280 GNUNET_NO);
1281 if (s->rc > 0) 1281 if (s->rc > 0)
1282 s->in_destroy = GNUNET_YES; 1282 s->in_destroy = GNUNET_YES;
@@ -1293,7 +1293,7 @@ disconnect_session (struct Session *s)
1293 * @return GNUNET_OK (continue to iterate) 1293 * @return GNUNET_OK (continue to iterate)
1294 */ 1294 */
1295static int 1295static int
1296disconnect_and_free_it (void *cls, const struct GNUNET_HashCode * key, void *value) 1296disconnect_and_free_it (void *cls, const struct GNUNET_PeerIdentity * key, void *value)
1297{ 1297{
1298 disconnect_session(value); 1298 disconnect_session(value);
1299 return GNUNET_OK; 1299 return GNUNET_OK;
@@ -1317,7 +1317,8 @@ udp_disconnect (void *cls, const struct GNUNET_PeerIdentity *target)
1317 LOG (GNUNET_ERROR_TYPE_DEBUG, 1317 LOG (GNUNET_ERROR_TYPE_DEBUG,
1318 "Disconnecting from peer `%s'\n", GNUNET_i2s (target)); 1318 "Disconnecting from peer `%s'\n", GNUNET_i2s (target));
1319 /* Clean up sessions */ 1319 /* Clean up sessions */
1320 GNUNET_CONTAINER_multihashmap_get_multiple (plugin->sessions, &target->hashPubKey, &disconnect_and_free_it, plugin); 1320 GNUNET_CONTAINER_multipeermap_get_multiple (plugin->sessions, target,
1321 &disconnect_and_free_it, plugin);
1321} 1322}
1322 1323
1323 1324
@@ -1466,7 +1467,7 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target,
1466 1467
1467static int 1468static int
1468session_cmp_it (void *cls, 1469session_cmp_it (void *cls,
1469 const struct GNUNET_HashCode * key, 1470 const struct GNUNET_PeerIdentity * key,
1470 void *value) 1471 void *value)
1471{ 1472{
1472 struct SessionCompareContext * cctx = cls; 1473 struct SessionCompareContext * cctx = cls;
@@ -1591,7 +1592,7 @@ udp_plugin_lookup_session (void *cls,
1591 "Looking for existing session for peer `%s' `%s' \n", 1592 "Looking for existing session for peer `%s' `%s' \n",
1592 GNUNET_i2s (&address->peer), 1593 GNUNET_i2s (&address->peer),
1593 udp_address_to_string(NULL, address->address, address->address_length)); 1594 udp_address_to_string(NULL, address->address, address->address_length));
1594 GNUNET_CONTAINER_multihashmap_get_multiple(plugin->sessions, &address->peer.hashPubKey, session_cmp_it, &cctx); 1595 GNUNET_CONTAINER_multipeermap_get_multiple(plugin->sessions, &address->peer, session_cmp_it, &cctx);
1595 if (cctx.res != NULL) 1596 if (cctx.res != NULL)
1596 { 1597 {
1597 LOG (GNUNET_ERROR_TYPE_DEBUG, "Found existing session %p\n", cctx.res); 1598 LOG (GNUNET_ERROR_TYPE_DEBUG, "Found existing session %p\n", cctx.res);
@@ -1623,13 +1624,13 @@ udp_plugin_create_session (void *cls,
1623 GNUNET_i2s(&address->peer), 1624 GNUNET_i2s(&address->peer),
1624 udp_address_to_string(NULL,address->address,address->address_length)); 1625 udp_address_to_string(NULL,address->address,address->address_length));
1625 GNUNET_assert (GNUNET_OK == 1626 GNUNET_assert (GNUNET_OK ==
1626 GNUNET_CONTAINER_multihashmap_put (plugin->sessions, 1627 GNUNET_CONTAINER_multipeermap_put (plugin->sessions,
1627 &s->target.hashPubKey, 1628 &s->target,
1628 s, 1629 s,
1629 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); 1630 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
1630 GNUNET_STATISTICS_set(plugin->env->stats, 1631 GNUNET_STATISTICS_set(plugin->env->stats,
1631 "# UDP, sessions active", 1632 "# UDP, sessions active",
1632 GNUNET_CONTAINER_multihashmap_size(plugin->sessions), 1633 GNUNET_CONTAINER_multipeermap_size(plugin->sessions),
1633 GNUNET_NO); 1634 GNUNET_NO);
1634 return s; 1635 return s;
1635} 1636}
@@ -1800,7 +1801,7 @@ udp_plugin_send (void *cls,
1800 GNUNET_break (0); 1801 GNUNET_break (0);
1801 return GNUNET_SYSERR; 1802 return GNUNET_SYSERR;
1802 } 1803 }
1803 if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains_value(plugin->sessions, &s->target.hashPubKey, s)) 1804 if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_contains_value(plugin->sessions, &s->target, s))
1804 { 1805 {
1805 GNUNET_break (0); 1806 GNUNET_break (0);
1806 return GNUNET_SYSERR; 1807 return GNUNET_SYSERR;
@@ -2137,7 +2138,9 @@ struct LookupContext
2137 2138
2138 2139
2139static int 2140static int
2140lookup_session_by_addr_it (void *cls, const struct GNUNET_HashCode * key, void *value) 2141lookup_session_by_addr_it (void *cls,
2142 const struct GNUNET_PeerIdentity *key,
2143 void *value)
2141{ 2144{
2142 struct LookupContext *l_ctx = cls; 2145 struct LookupContext *l_ctx = cls;
2143 struct Session * s = value; 2146 struct Session * s = value;
@@ -2184,7 +2187,7 @@ ack_proc (void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg)
2184 l_ctx.addrlen = rc->addr_len; 2187 l_ctx.addrlen = rc->addr_len;
2185 l_ctx.res = NULL; 2188 l_ctx.res = NULL;
2186 l_ctx.must_have_frag_ctx = GNUNET_NO; 2189 l_ctx.must_have_frag_ctx = GNUNET_NO;
2187 GNUNET_CONTAINER_multihashmap_iterate (rc->plugin->sessions, 2190 GNUNET_CONTAINER_multipeermap_iterate (rc->plugin->sessions,
2188 &lookup_session_by_addr_it, 2191 &lookup_session_by_addr_it,
2189 &l_ctx); 2192 &l_ctx);
2190 s = l_ctx.res; 2193 s = l_ctx.res;
@@ -2259,7 +2262,7 @@ read_process_ack (struct Plugin *plugin,
2259 l_ctx.addrlen = fromlen; 2262 l_ctx.addrlen = fromlen;
2260 l_ctx.res = NULL; 2263 l_ctx.res = NULL;
2261 l_ctx.must_have_frag_ctx = GNUNET_YES; 2264 l_ctx.must_have_frag_ctx = GNUNET_YES;
2262 GNUNET_CONTAINER_multihashmap_iterate (plugin->sessions, 2265 GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions,
2263 &lookup_session_by_addr_it, 2266 &lookup_session_by_addr_it,
2264 &l_ctx); 2267 &l_ctx);
2265 s = l_ctx.res; 2268 s = l_ctx.res;
@@ -3111,7 +3114,7 @@ libgnunet_plugin_transport_udp_init (void *cls)
3111 p->enable_ipv6 = enable_v6; 3114 p->enable_ipv6 = enable_v6;
3112 p->enable_ipv4 = GNUNET_YES; /* default */ 3115 p->enable_ipv4 = GNUNET_YES; /* default */
3113 p->env = env; 3116 p->env = env;
3114 p->sessions = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); 3117 p->sessions = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO);
3115 p->defrag_ctxs = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 3118 p->defrag_ctxs = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
3116 p->mst = GNUNET_SERVER_mst_create (&process_inbound_tokenized_messages, p); 3119 p->mst = GNUNET_SERVER_mst_create (&process_inbound_tokenized_messages, p);
3117 GNUNET_BANDWIDTH_tracker_init (&p->tracker, 3120 GNUNET_BANDWIDTH_tracker_init (&p->tracker,
@@ -3125,7 +3128,7 @@ libgnunet_plugin_transport_udp_init (void *cls)
3125 { 3128 {
3126 LOG (GNUNET_ERROR_TYPE_ERROR, 3129 LOG (GNUNET_ERROR_TYPE_ERROR,
3127 _("Failed to create network sockets, plugin failed\n")); 3130 _("Failed to create network sockets, plugin failed\n"));
3128 GNUNET_CONTAINER_multihashmap_destroy (p->sessions); 3131 GNUNET_CONTAINER_multipeermap_destroy (p->sessions);
3129 GNUNET_CONTAINER_heap_destroy (p->defrag_ctxs); 3132 GNUNET_CONTAINER_heap_destroy (p->defrag_ctxs);
3130 GNUNET_SERVER_mst_destroy (p->mst); 3133 GNUNET_SERVER_mst_destroy (p->mst);
3131 GNUNET_free (p); 3134 GNUNET_free (p);
@@ -3267,8 +3270,8 @@ libgnunet_plugin_transport_udp_done (void *cls)
3267 /* Clean up sessions */ 3270 /* Clean up sessions */
3268 LOG (GNUNET_ERROR_TYPE_DEBUG, 3271 LOG (GNUNET_ERROR_TYPE_DEBUG,
3269 "Cleaning up sessions\n"); 3272 "Cleaning up sessions\n");
3270 GNUNET_CONTAINER_multihashmap_iterate (plugin->sessions, &disconnect_and_free_it, plugin); 3273 GNUNET_CONTAINER_multipeermap_iterate (plugin->sessions, &disconnect_and_free_it, plugin);
3271 GNUNET_CONTAINER_multihashmap_destroy (plugin->sessions); 3274 GNUNET_CONTAINER_multipeermap_destroy (plugin->sessions);
3272 3275
3273 next = ppc_dll_head; 3276 next = ppc_dll_head;
3274 for (cur = next; NULL != cur; cur = next) 3277 for (cur = next; NULL != cur; cur = next)