From b9e7bbea6e7628e77fdbcfdd6832587a07d43658 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 9 Sep 2011 13:21:48 +0000 Subject: [PATCH] misc train hacking --- TODO | 14 ++----- src/include/gnunet_resolver_service.h | 2 - src/testing/testing.c | 2 - src/testing/testing_peergroup.c | 1 - src/transport/gnunet-service-transport-new.c | 3 +- .../gnunet-service-transport_blacklist.c | 2 +- .../gnunet-service-transport_clients.c | 2 +- .../gnunet-service-transport_neighbours.c | 37 +++++++++++++++++-- .../gnunet-service-transport_plugins.c | 1 - .../gnunet-service-transport_validation.c | 9 +---- .../gnunet-service-transport_validation.h | 2 - src/transport/plugin_transport_udp.c | 15 +------- src/util/resolver_api.c | 2 - 13 files changed, 44 insertions(+), 48 deletions(-) diff --git a/TODO b/TODO index ab1cce5fb..5e68b7a51 100644 --- a/TODO +++ b/TODO @@ -1,14 +1,5 @@ 0.9.0pre3: -* connections fail if transport-plugin/nat produces - some addresses that don't work (enable 'use_localaddr' with bindto for example, - so that some of the 'local' IPs do not work due to the bindto); the result - seems to be that the plugin tries some of the broken addresses, fails and the - transport-level connection never comes up. - [still an issue?] -* transport: - - explicit CONNECT: add timestamp - - explicit DISCONNECT: add signature -* clean buildbots +* clean buildbots (with new transport) 0.9.0pre4: * GNUNET-GTK: [CG] @@ -23,6 +14,9 @@ + insert + download + search +* transport: + - explicit DISCONNECT: add signature, create message... + - CONNECT: actually consider switching session... 0.9.0: * new webpage: diff --git a/src/include/gnunet_resolver_service.h b/src/include/gnunet_resolver_service.h index ca6544e94..86499a8c0 100644 --- a/src/include/gnunet_resolver_service.h +++ b/src/include/gnunet_resolver_service.h @@ -94,7 +94,6 @@ GNUNET_RESOLVER_ip_get (const char *hostname, int domain, /** * Resolve our hostname to an IP address. * - * @param cfg configuration to use * @param domain AF_INET or AF_INET6; use AF_UNSPEC for "any" * @param callback function to call with addresses * @param cls closure for callback @@ -130,7 +129,6 @@ GNUNET_RESOLVER_local_fqdn_get (void); /** * Perform a reverse DNS lookup. * - * @param cfg configuration to use * @param sa host address * @param salen length of host address * @param do_resolve use GNUNET_NO to return numeric hostname diff --git a/src/testing/testing.c b/src/testing/testing.c index 78ed39e4a..65446eb77 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -1418,8 +1418,6 @@ GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, * @param timeout how long to wait for process for shutdown to complete * @param cb function called once the daemon was stopped * @param cb_cls closure for cb - * @param allow_restart GNUNET_YES to restart peer later (using this API) - * GNUNET_NO to kill off and clean up for good */ void GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, diff --git a/src/testing/testing_peergroup.c b/src/testing/testing_peergroup.c index ba25a62bd..90c0f0373 100644 --- a/src/testing/testing_peergroup.c +++ b/src/testing/testing_peergroup.c @@ -599,7 +599,6 @@ internal_hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id, * @param cls closure * @param first peer id for first daemon * @param second peer id for the second daemon - * @param distance distance between the connected peers * @param emsg error message (NULL on success) */ void diff --git a/src/transport/gnunet-service-transport-new.c b/src/transport/gnunet-service-transport-new.c index f4a39a1e6..4b1becacd 100644 --- a/src/transport/gnunet-service-transport-new.c +++ b/src/transport/gnunet-service-transport-new.c @@ -201,7 +201,8 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT: (void) GST_blacklist_test_allowed (peer, NULL, &try_connect_if_allowed, NULL); - /* TODO: if 'session != NULL', maybe notify ATS that this is now the preferred + /* TODO: if 'session != NULL', and timestamp more recent than the + previous one, maybe notify ATS that this is now the preferred * way to communicate with this peer (other peer switched transport) */ break; case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT: diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c index 36abbf85c..a73aa17c1 100644 --- a/src/transport/gnunet-service-transport_blacklist.c +++ b/src/transport/gnunet-service-transport_blacklist.c @@ -547,7 +547,7 @@ struct TestConnectionContext * blacklisting client. * * @param cls the 'struct TestConnectionContest' - * @param pid neighbour's identity + * @param neighbour neighbour's identity * @param ats performance data * @param ats_count number of entries in ats (excluding 0-termination) */ diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index 8676f335e..7e519a547 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c @@ -228,7 +228,7 @@ transmit_to_client_callback (void *cls, size_t size, void *buf) /** * Queue the given message for transmission to the given client * - * @param client target of the message + * @param tc target of the message * @param msg message to transmit * @param may_drop GNUNET_YES if the message can be dropped */ diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 9c6aaba67..6e3ee8a71 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -51,6 +51,32 @@ */ struct NeighbourMapEntry; +/** + * Message a peer sends to another to indicate its + * preference for communicating via a particular + * session (and the desire to establish a real + * connection). + */ +struct SessionConnectMessage +{ + /** + * Header of type 'GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT' + */ + struct GNUNET_MessageHeader header; + + /** + * Always zero. + */ + uint32_t reserved GNUNET_PACKED; + + /** + * Absolute time at the sender. Only the most recent connect + * message implies which session is preferred by the sender. + */ + struct GNUNET_TIME_AbsoluteNBO timestamp; + +}; + /** * For each neighbour we keep a list of messages @@ -288,7 +314,7 @@ transmit_send_continuation (void *cls, * Check the ready list for the given neighbour and if a plugin is * ready for transmission (and if we have a message), do so! * - * @param neighbour target peer for which to transmit + * @param n target peer for which to transmit */ static void try_transmission_to_peer (struct NeighbourMapEntry *n) @@ -520,7 +546,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, *ats, uint32_t ats_count) { struct NeighbourMapEntry *n; - struct GNUNET_MessageHeader connect_msg; + struct SessionConnectMessage connect_msg; GNUNET_assert (neighbours != NULL); @@ -555,8 +581,10 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, n->timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, &neighbour_timeout_task, n); - connect_msg.size = htons (sizeof (struct GNUNET_MessageHeader)); - connect_msg.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT); + connect_msg.header.size = htons (sizeof (struct SessionConnectMessage)); + connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT); + connect_msg.reserved = htonl (0); + connect_msg.timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg), GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); } @@ -570,6 +598,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, * @param plugin_name name of the plugin * @param plugin_address binary address * @param plugin_address_len length of address + * @param session session to use * @param bandwidth available bandwidth * @param ats performance data for the address (as far as known) * @param ats_count number of performance records in 'ats' diff --git a/src/transport/gnunet-service-transport_plugins.c b/src/transport/gnunet-service-transport_plugins.c index 12ee231c4..52fcf661d 100644 --- a/src/transport/gnunet-service-transport_plugins.c +++ b/src/transport/gnunet-service-transport_plugins.c @@ -87,7 +87,6 @@ static struct TransportPlugin *plugins_tail; * * @param recv_cb function to call when data is received * @param address_cb function to call when our public addresses changed - * @param traffic_cb function to call for flow control * @param session_end_cb function to call when a session was terminated */ void diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 56b4037b4..57fa86260 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c @@ -335,9 +335,6 @@ validation_entry_match (void *cls, const GNUNET_HashCode * key, void *value) * @param public_key public key of the peer, NULL for unknown * @param neighbour which peer we care about * @param tname name of the transport plugin - * @param session session to look for, NULL for 'any'; otherwise - * can be used for the service to "learn" this session ID - * if 'addr' matches * @param addr binary address * @param addrlen length of addr * @return validation entry matching the given specifications, NULL @@ -425,7 +422,7 @@ add_valid_address (void *cls, const char *tname, * @param cls unused * @param peer id of the peer, NULL for last call * @param hello hello message for the peer (can be NULL) - * @param error message + * @param err_msg error message */ static void process_peerinfo_hello (void *cls, const struct GNUNET_PeerIdentity *peer, @@ -1077,12 +1074,8 @@ iterate_addresses (void *cls, const GNUNET_HashCode * key, void *value) * Can either give a snapshot (synchronous API) or be continuous. * * @param target peer information is requested for - * @param snapshot_only GNUNET_YES to iterate over addresses once, GNUNET_NO to - * continue to give information about addresses as it evolves * @param cb function to call; will not be called after this function returns - * if snapshot_only is GNUNET_YES * @param cb_cls closure for 'cb' - * @return context to cancel, NULL if 'snapshot_only' is GNUNET_YES */ void GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target, diff --git a/src/transport/gnunet-service-transport_validation.h b/src/transport/gnunet-service-transport_validation.h index 1840c0919..06370161c 100644 --- a/src/transport/gnunet-service-transport_validation.h +++ b/src/transport/gnunet-service-transport_validation.h @@ -122,9 +122,7 @@ typedef void (*GST_ValidationAddressCallback) (void *cls, * * @param target peer information is requested for * @param cb function to call; will not be called after this function returns - * if snapshot_only is GNUNET_YES * @param cb_cls closure for 'cb' - * @return context to cancel, NULL if 'snapshot_only' is GNUNET_YES */ void GST_validation_get_addresses (const struct GNUNET_PeerIdentity *target, diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index cced16ffd..3a69273c5 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -335,19 +335,8 @@ udp_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) * Actually send out the message. * * @param plugin the plugin - * @param send_handle which handle to send message on - * @param target who should receive this message (ignored by UDP) - * @param msgbuf one or more GNUNET_MessageHeader(s) strung together - * @param msgbuf_size the size of the msgbuf to send - * @param priority how important is the message (ignored by UDP) - * @param timeout when should we time out (give up) if we can not transmit? - * @param addr the addr to send the message to, needs to be a sockaddr for us - * @param addrlen the len of addr - * @param cont continuation to call once the message has - * been transmitted (or if the transport is ready - * for the next transmission call; or if the - * peer disconnected...) - * @param cont_cls closure for cont + * @param sa the address to send the message to + * @param msg message to transmit * @return the number of bytes written */ static ssize_t diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index 87b7bbd46..a59b9639f 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c @@ -582,8 +582,6 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /** * Process pending requests to the resolver. - * - * @param h handle to the resolver */ static void process_requests () -- 2.25.1