diff options
author | Shichao <mrrr61@outlook.com> | 2024-05-22 18:14:04 +0800 |
---|---|---|
committer | Shichao <mrrr61@outlook.com> | 2024-05-24 10:40:11 +0800 |
commit | 19c1002a22b6f19bd64eb714d6e7e65089a7bbf2 (patch) | |
tree | c5f10784cf79a54141da879cdcfe0a93839c48ca | |
parent | c13020bec2896a8c115f230f2dee5f575b5ebe1f (diff) | |
download | gnunet-dev/shichao/http3.tar.gz gnunet-dev/shichao/http3.zip |
http3: do shutdowndev/shichao/http3
-rw-r--r-- | src/service/transport/gnunet-communicator-http3.c | 73 |
1 files changed, 72 insertions, 1 deletions
diff --git a/src/service/transport/gnunet-communicator-http3.c b/src/service/transport/gnunet-communicator-http3.c index 47ce6aa4c..383dba8f1 100644 --- a/src/service/transport/gnunet-communicator-http3.c +++ b/src/service/transport/gnunet-communicator-http3.c | |||
@@ -1266,6 +1266,27 @@ nat_address_cb (void *cls, | |||
1266 | 1266 | ||
1267 | 1267 | ||
1268 | /** | 1268 | /** |
1269 | * Iterator over all connection to clean up. | ||
1270 | * | ||
1271 | * @param cls NULL | ||
1272 | * @param key connection->address | ||
1273 | * @param value the connection to destroy | ||
1274 | * @return #GNUNET_OK to continue to iterate | ||
1275 | */ | ||
1276 | static int | ||
1277 | get_connection_delete_it (void *cls, | ||
1278 | const struct GNUNET_HashCode *key, | ||
1279 | void *value) | ||
1280 | { | ||
1281 | struct Connection *connection = value; | ||
1282 | (void) cls; | ||
1283 | (void) key; | ||
1284 | connection_destroy (connection); | ||
1285 | return GNUNET_OK; | ||
1286 | } | ||
1287 | |||
1288 | |||
1289 | /** | ||
1269 | * Shutdown the HTTP3 communicator. | 1290 | * Shutdown the HTTP3 communicator. |
1270 | * | 1291 | * |
1271 | * @param cls NULL (always) | 1292 | * @param cls NULL (always) |
@@ -1273,7 +1294,57 @@ nat_address_cb (void *cls, | |||
1273 | static void | 1294 | static void |
1274 | do_shutdown (void *cls) | 1295 | do_shutdown (void *cls) |
1275 | { | 1296 | { |
1276 | 1297 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |
1298 | "do_shutdown start\n"); | ||
1299 | GNUNET_CONTAINER_multihashmap_iterate (addr_map, | ||
1300 | &get_connection_delete_it, | ||
1301 | NULL); | ||
1302 | GNUNET_CONTAINER_multihashmap_destroy (addr_map); | ||
1303 | gnutls_certificate_free_credentials (cred); | ||
1304 | |||
1305 | if (NULL != nat) | ||
1306 | { | ||
1307 | GNUNET_NAT_unregister (nat); | ||
1308 | nat = NULL; | ||
1309 | } | ||
1310 | if (NULL != read_task) | ||
1311 | { | ||
1312 | GNUNET_SCHEDULER_cancel (read_task); | ||
1313 | read_task = NULL; | ||
1314 | } | ||
1315 | if (NULL != udp_sock) | ||
1316 | { | ||
1317 | GNUNET_break (GNUNET_OK == | ||
1318 | GNUNET_NETWORK_socket_close (udp_sock)); | ||
1319 | udp_sock = NULL; | ||
1320 | } | ||
1321 | if (NULL != ch) | ||
1322 | { | ||
1323 | GNUNET_TRANSPORT_communicator_disconnect (ch); | ||
1324 | ch = NULL; | ||
1325 | } | ||
1326 | if (NULL != ah) | ||
1327 | { | ||
1328 | GNUNET_TRANSPORT_application_done (ah); | ||
1329 | ah = NULL; | ||
1330 | } | ||
1331 | if (NULL != stats) | ||
1332 | { | ||
1333 | GNUNET_STATISTICS_destroy (stats, GNUNET_YES); | ||
1334 | stats = NULL; | ||
1335 | } | ||
1336 | if (NULL != my_private_key) | ||
1337 | { | ||
1338 | GNUNET_free (my_private_key); | ||
1339 | my_private_key = NULL; | ||
1340 | } | ||
1341 | if (NULL != is) | ||
1342 | { | ||
1343 | GNUNET_NT_scanner_done (is); | ||
1344 | is = NULL; | ||
1345 | } | ||
1346 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1347 | "do_shutdown finished\n"); | ||
1277 | } | 1348 | } |
1278 | 1349 | ||
1279 | 1350 | ||