From f44c0036572d5557d2496748a4190a61e40e61ff Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 22 Oct 2011 21:59:27 +0000 Subject: replacing 0-terminated atsi-array with array+length in core API (and the core-connect IPC) --- src/hostlist/gnunet-daemon-hostlist.c | 15 ++++++++++----- src/hostlist/hostlist-client.c | 8 ++++++-- src/hostlist/hostlist-server.c | 4 +++- src/hostlist/test_gnunet_daemon_hostlist_learning.c | 3 ++- 4 files changed, 21 insertions(+), 9 deletions(-) (limited to 'src/hostlist') diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index fb23d2345..2ef807444 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c @@ -136,14 +136,17 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server, /** * Core handler for p2p hostlist advertisements + * + * @param atsi_count number of records in 'atsi' */ static int advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { GNUNET_assert (NULL != client_adv_handler); - return (*client_adv_handler) (cls, peer, message, atsi); + return (*client_adv_handler) (cls, peer, message, atsi, atsi_count); } @@ -153,20 +156,22 @@ advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer, * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' */ static void connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { if (0 == memcmp (&me, peer, sizeof (struct GNUNET_PeerIdentity))) return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "A new peer connected, notifying client and server\n"); if (NULL != client_ch) - (*client_ch) (cls, peer, atsi); + (*client_ch) (cls, peer, atsi, atsi_count); #if HAVE_MHD if (NULL != server_ch) - (*server_ch) (cls, peer, atsi); + (*server_ch) (cls, peer, atsi, atsi_count); #endif } diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c index 1f3ad2a7c..ba5093779 100644 --- a/src/hostlist/hostlist-client.c +++ b/src/hostlist/hostlist-client.c @@ -1107,10 +1107,12 @@ task_hostlist_saving (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' */ static void handler_connect (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { GNUNET_assert (stat_connection_count < UINT_MAX); stat_connection_count++; @@ -1142,13 +1144,15 @@ handler_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) * @param peer the peer sending the message * @param message the actual message * @param atsi performance data + * @param atsi_count number of records in 'atsi' * @return GNUNET_OK to keep the connection open, * GNUNET_SYSERR to close it (signal serious error) */ static int handler_advertisement (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { size_t size; size_t uri_size; diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c index fb4c1b1b9..a6d9c126c 100644 --- a/src/hostlist/hostlist-server.c +++ b/src/hostlist/hostlist-server.c @@ -362,10 +362,12 @@ adv_transmit_ready (void *cls, size_t size, void *buf) * @param cls closure * @param peer peer identity this notification is about * @param atsi performance data + * @param atsi_count number of records in 'atsi' */ static void connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { size_t size; diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index 9d72433ce..dfeca8d57 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c @@ -298,7 +298,8 @@ check_statistics (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static int ad_arrive_handler (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *atsi) + const struct GNUNET_ATS_Information *atsi, + unsigned int atsi_count) { char *hostname; char *expected_uri; -- cgit v1.2.3