diff options
author | marshall <stmr@umich.edu> | 2023-08-22 12:08:03 -0400 |
---|---|---|
committer | marshall <stmr@umich.edu> | 2023-08-22 12:08:03 -0400 |
commit | 0fbfab67d4b2b227460ab0e38670c4cbc7e5ffcd (patch) | |
tree | c2699e6ccffbeb18fd7b6eef56127964afb2926b /src/transport | |
parent | 1169a0ac1c6e6fce75bd2cf37a666ae8e1ba13fe (diff) | |
download | gnunet-0fbfab67d4b2b227460ab0e38670c4cbc7e5ffcd.tar.gz gnunet-0fbfab67d4b2b227460ab0e38670c4cbc7e5ffcd.zip |
quic: update logs
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-communicator-quic.c | 81 |
1 files changed, 53 insertions, 28 deletions
diff --git a/src/transport/gnunet-communicator-quic.c b/src/transport/gnunet-communicator-quic.c index e9116323a..0f3219aad 100644 --- a/src/transport/gnunet-communicator-quic.c +++ b/src/transport/gnunet-communicator-quic.c | |||
@@ -364,8 +364,9 @@ create_conn (uint8_t *scid, size_t scid_len, | |||
364 | conn = GNUNET_new (struct quic_conn); | 364 | conn = GNUNET_new (struct quic_conn); |
365 | if (scid_len != LOCAL_CONN_ID_LEN) | 365 | if (scid_len != LOCAL_CONN_ID_LEN) |
366 | { | 366 | { |
367 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 367 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
368 | "error while creating connection, scid length too short\n"); | 368 | "error while creating connection, scid length too short: %zu\n", |
369 | scid_len); | ||
369 | return NULL; | 370 | return NULL; |
370 | } | 371 | } |
371 | 372 | ||
@@ -408,7 +409,9 @@ flush_egress (struct quic_conn *conn) | |||
408 | } | 409 | } |
409 | if (0 > written) | 410 | if (0 > written) |
410 | { | 411 | { |
411 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "quiche failed to create packet\n"); | 412 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
413 | "quiche failed to create packet. quiche error: %zd\n", | ||
414 | written); | ||
412 | return; | 415 | return; |
413 | } | 416 | } |
414 | sent = GNUNET_NETWORK_socket_sendto (udp_sock, out, written, | 417 | sent = GNUNET_NETWORK_socket_sendto (udp_sock, out, written, |
@@ -537,7 +540,11 @@ mq_send_d (struct GNUNET_MQ_Handle *mq, | |||
537 | peer->d_mtu); | 540 | peer->d_mtu); |
538 | GNUNET_break (0); | 541 | GNUNET_break (0); |
539 | if (GNUNET_YES != peer->peer_destroy_called) | 542 | if (GNUNET_YES != peer->peer_destroy_called) |
543 | { | ||
544 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
545 | "peer destroy called, destroying peer\n"); | ||
540 | peer_destroy (peer); | 546 | peer_destroy (peer); |
547 | } | ||
541 | return; | 548 | return; |
542 | } | 549 | } |
543 | reschedule_peer_timeout (peer); | 550 | reschedule_peer_timeout (peer); |
@@ -989,6 +996,8 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer_id, const | |||
989 | } | 996 | } |
990 | path = &address[strlen (COMMUNICATOR_ADDRESS_PREFIX "-")]; | 997 | path = &address[strlen (COMMUNICATOR_ADDRESS_PREFIX "-")]; |
991 | in = udp_address_to_sockaddr (path, &in_len); | 998 | in = udp_address_to_sockaddr (path, &in_len); |
999 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mq_init in_len length before: %d\n", | ||
1000 | in_len); | ||
992 | /** | 1001 | /** |
993 | * If we already have a queue with this peer, ignore | 1002 | * If we already have a queue with this peer, ignore |
994 | */ | 1003 | */ |
@@ -1019,7 +1028,10 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer_id, const | |||
1019 | GNUNET_CONTAINER_multihashmap_put (addr_map, &addr_key, | 1028 | GNUNET_CONTAINER_multihashmap_put (addr_map, &addr_key, |
1020 | peer, | 1029 | peer, |
1021 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1030 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
1022 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Added new peer to the addr map\n"); | 1031 | struct sockaddr_in *testp = (struct sockaddr_in *) peer->address; |
1032 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1033 | "mq_init added new peer to the addr map. sin_len: %d\n", | ||
1034 | testp->sin_len); | ||
1023 | /** | 1035 | /** |
1024 | * Before setting up peer mq, initiate a quic connection to the target (perform handshake w/ quiche) | 1036 | * Before setting up peer mq, initiate a quic connection to the target (perform handshake w/ quiche) |
1025 | */ | 1037 | */ |
@@ -1035,30 +1047,27 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer_id, const | |||
1035 | local_in_len, peer->address, peer->address_len, | 1047 | local_in_len, peer->address, peer->address_len, |
1036 | config); | 1048 | config); |
1037 | flush_egress (peer->conn); | 1049 | flush_egress (peer->conn); |
1038 | if (GNUNET_NO == quiche_conn_is_established (q_conn->conn)) | 1050 | return GNUNET_OK; |
1039 | { | 1051 | // GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1040 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1052 | // "Handshake established with peer, sending our peer id\n"); |
1041 | "Failed to form connection to peer. mq not created\n"); | ||
1042 | return GNUNET_NO; | ||
1043 | } | ||
1044 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1045 | "Handshake established with peer, sending our peer id\n"); | ||
1046 | /** | 1053 | /** |
1047 | * Send our pid | 1054 | * Send our pid: do this after connection has been established. TODO: move to sock_read |
1055 | */ | ||
1056 | // GNUNET_memcpy (my_pid, &my_identity, PEERID_LEN); | ||
1057 | // send_len = quiche_conn_stream_send (peer->conn->conn, STREAMID_BI, my_pid, | ||
1058 | // PEERID_LEN, | ||
1059 | // false); | ||
1060 | // if (0 > send_len) | ||
1061 | // { | ||
1062 | // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1063 | // "Failed to write peer identity packet\n"); | ||
1064 | // return GNUNET_NO; | ||
1065 | // } | ||
1066 | // flush_egress (peer->conn); | ||
1067 | // GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer identity sent to peer\n"); | ||
1068 | /** | ||
1069 | * TODO: setup peer mq after sending our pid (in sock_read) | ||
1048 | */ | 1070 | */ |
1049 | GNUNET_memcpy (my_pid, &my_identity, PEERID_LEN); | ||
1050 | send_len = quiche_conn_stream_send (peer->conn->conn, STREAMID_BI, my_pid, | ||
1051 | PEERID_LEN, | ||
1052 | false); | ||
1053 | if (0 > send_len) | ||
1054 | { | ||
1055 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1056 | "Failed to write peer identity packet\n"); | ||
1057 | return GNUNET_NO; | ||
1058 | } | ||
1059 | flush_egress (peer->conn); | ||
1060 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer identity sent to peer\n"); | ||
1061 | |||
1062 | setup_peer_mq (peer); | 1071 | setup_peer_mq (peer); |
1063 | if (NULL == timeout_task) | 1072 | if (NULL == timeout_task) |
1064 | timeout_task = GNUNET_SCHEDULER_add_now (&check_timeouts, NULL); | 1073 | timeout_task = GNUNET_SCHEDULER_add_now (&check_timeouts, NULL); |
@@ -1271,7 +1280,10 @@ sock_read (void *cls) | |||
1271 | "tried to add duplicate address into address map\n"); | 1280 | "tried to add duplicate address into address map\n"); |
1272 | return; | 1281 | return; |
1273 | } | 1282 | } |
1274 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "added new peer to address map\n"); | 1283 | struct sockaddr_in *testp = (struct sockaddr_in *) peer->address; |
1284 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1285 | "sock_read added new peer to address map. port: %d\n", | ||
1286 | testp->sin_len); | ||
1275 | } | 1287 | } |
1276 | 1288 | ||
1277 | /** | 1289 | /** |
@@ -1367,6 +1379,7 @@ sock_read (void *cls) | |||
1367 | } | 1379 | } |
1368 | 1380 | ||
1369 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sent %zd bytes\n", sent); | 1381 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sent %zd bytes\n", sent); |
1382 | continue; | ||
1370 | } | 1383 | } |
1371 | 1384 | ||
1372 | if (GNUNET_OK != validate_token (quic_header.token, quic_header.token_len, | 1385 | if (GNUNET_OK != validate_token (quic_header.token, quic_header.token_len, |
@@ -1561,7 +1574,19 @@ run (void *cls, | |||
1561 | */ | 1574 | */ |
1562 | config = quiche_config_new (QUICHE_PROTOCOL_VERSION); | 1575 | config = quiche_config_new (QUICHE_PROTOCOL_VERSION); |
1563 | quiche_config_verify_peer (config, false); | 1576 | quiche_config_verify_peer (config, false); |
1564 | // conn_map = GNUNET_CONTAINER_multihashmap_create (2, GNUNET_NO); | 1577 | quiche_config_set_application_protos (config, |
1578 | (uint8_t *) | ||
1579 | "\x0ahq-interop\x05hq-29\x05hq-28\x05hq-27\x08http/0.9", | ||
1580 | 38); | ||
1581 | quiche_config_set_max_idle_timeout (config, 5000); | ||
1582 | quiche_config_set_max_recv_udp_payload_size (config, MAX_DATAGRAM_SIZE); | ||
1583 | quiche_config_set_max_send_udp_payload_size (config, MAX_DATAGRAM_SIZE); | ||
1584 | quiche_config_set_initial_max_data (config, 10000000); | ||
1585 | quiche_config_set_initial_max_stream_data_bidi_local (config, 1000000); | ||
1586 | quiche_config_set_initial_max_stream_data_uni (config, 1000000); | ||
1587 | quiche_config_set_initial_max_streams_bidi (config, 100); | ||
1588 | quiche_config_set_initial_max_streams_uni (config, 100); | ||
1589 | quiche_config_set_disable_active_migration (config, true); | ||
1565 | addr_map = GNUNET_CONTAINER_multihashmap_create (2, GNUNET_NO); | 1590 | addr_map = GNUNET_CONTAINER_multihashmap_create (2, GNUNET_NO); |
1566 | /** | 1591 | /** |
1567 | * Get our public key for initial packet | 1592 | * Get our public key for initial packet |