[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 23/40: NEWS: Changed method GNUNET_HELLO_builder_get_expiration
From: |
gnunet |
Subject: |
[gnunet] 23/40: NEWS: Changed method GNUNET_HELLO_builder_get_expiration_time to not need parameter GNUNET_HELLO_Builder. |
Date: |
Thu, 05 Oct 2023 08:57:26 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 84913ba1514b516944887f6aef3d46979ea361cb
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Mon Oct 2 18:14:35 2023 +0200
NEWS: Changed method GNUNET_HELLO_builder_get_expiration_time to not need
parameter GNUNET_HELLO_Builder.
---
src/cadet/gnunet-service-cadet_hello.c | 11 ++++-------
src/cadet/gnunet-service-cadet_peer.c | 27 ++++++++++++---------------
src/hostlist/gnunet-daemon-hostlist_server.c | 13 ++++---------
src/include/gnunet_hello_uri_lib.h | 5 ++---
4 files changed, 22 insertions(+), 34 deletions(-)
diff --git a/src/cadet/gnunet-service-cadet_hello.c
b/src/cadet/gnunet-service-cadet_hello.c
index 7a33b0e05..1e3322733 100644
--- a/src/cadet/gnunet-service-cadet_hello.c
+++ b/src/cadet/gnunet-service-cadet_hello.c
@@ -68,7 +68,6 @@ got_hello (void *cls,
const char *err_msg)
{
struct CadetPeer *peer;
- struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg (hello);
if ((NULL == id) ||
(NULL == hello))
@@ -81,19 +80,17 @@ got_hello (void *cls,
GCD_hello_update ();
return;
}
-
+
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Hello for %s (%d bytes), expires on %s\n",
GNUNET_i2s (id),
sizeof (hello),
GNUNET_STRINGS_absolute_time_to_string (
-
GNUNET_HELLO_builder_get_expiration_time (builder,
-
hello)));
+ GNUNET_HELLO_builder_get_expiration_time (hello)));
peer = GCP_get (id,
GNUNET_YES);
GCP_set_hello (peer,
hello);
- GNUNET_HELLO_builder_free (builder);
}
@@ -108,8 +105,8 @@ GCH_init (const struct GNUNET_CONFIGURATION_Handle *c)
GNUNET_assert (NULL == peerstore_notify);
peerstore = GNUNET_PEERSTORE_connect (c);
peerstore_notify =
- GNUNET_PEERSTORE_hello_changed_notify (peerstore, GNUNET_NO, &got_hello,
- NULL);
+ GNUNET_PEERSTORE_hello_changed_notify (peerstore, GNUNET_NO, &got_hello,
+ NULL);
}
diff --git a/src/cadet/gnunet-service-cadet_peer.c
b/src/cadet/gnunet-service-cadet_peer.c
index c46e968dc..5c810e926 100644
--- a/src/cadet/gnunet-service-cadet_peer.c
+++ b/src/cadet/gnunet-service-cadet_peer.c
@@ -491,15 +491,13 @@ consider_peer_destroy (struct CadetPeer *cp)
return; /* still relevant! */
if (NULL != cp->hello)
{
- struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg
(cp->hello);
-
/* relevant only until HELLO expires */
- exp = GNUNET_TIME_absolute_get_remaining
(GNUNET_HELLO_builder_get_expiration_time (builder,
-
cp->hello));
+ exp = GNUNET_TIME_absolute_get_remaining (
+ GNUNET_HELLO_builder_get_expiration_time (cp
+ ->hello));
cp->destroy_task = GNUNET_SCHEDULER_add_delayed (exp,
&destroy_peer,
cp);
- GNUNET_HELLO_builder_free (builder);
return;
}
cp->destroy_task = GNUNET_SCHEDULER_add_delayed (IDLE_PEER_TIMEOUT,
@@ -1323,14 +1321,15 @@ GCP_set_hello (struct CadetPeer *cp,
if (NULL != cp->hello)
{
struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
- struct GNUNET_HELLO_Builder *builder = GNUNET_HELLO_builder_from_msg
(hello);
- struct GNUNET_HELLO_Builder *cp_builder = GNUNET_HELLO_builder_from_msg
(cp->hello);
- struct GNUNET_TIME_Absolute new_hello_exp =
GNUNET_HELLO_builder_get_expiration_time (builder,
-
hello);
- struct GNUNET_TIME_Absolute old_hello_exp =
GNUNET_HELLO_builder_get_expiration_time (cp_builder,
-
cp->hello);
-
- if (GNUNET_TIME_absolute_cmp (new_hello_exp, > , now) &&
GNUNET_TIME_absolute_cmp (new_hello_exp, > , old_hello_exp))
+
+ struct GNUNET_TIME_Absolute new_hello_exp =
+ GNUNET_HELLO_builder_get_expiration_time (hello);
+ struct GNUNET_TIME_Absolute old_hello_exp =
+ GNUNET_HELLO_builder_get_expiration_time (cp
+ ->hello);
+
+ if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) &&
+ GNUNET_TIME_absolute_cmp (new_hello_exp, >, old_hello_exp))
{
GNUNET_free (cp->hello);
cp->hello = GNUNET_malloc (size);
@@ -1340,8 +1339,6 @@ GCP_set_hello (struct CadetPeer *cp,
{
return;
}
- GNUNET_HELLO_builder_free (builder);
- GNUNET_HELLO_builder_free (cp_builder);
}
else
{
diff --git a/src/hostlist/gnunet-daemon-hostlist_server.c
b/src/hostlist/gnunet-daemon-hostlist_server.c
index 4c276ce80..f383ec394 100644
--- a/src/hostlist/gnunet-daemon-hostlist_server.c
+++ b/src/hostlist/gnunet-daemon-hostlist_server.c
@@ -195,11 +195,10 @@ host_processor (void *cls,
{
size_t old;
size_t s;
- struct GNUNET_HELLO_Builder *hello_builder;
struct GNUNET_MessageHeader *hello;
struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
struct GNUNET_TIME_Absolute hello_exp;
-
+
if (NULL != emsg)
{
GNUNET_assert (NULL == &record->peer);
@@ -226,19 +225,17 @@ host_processor (void *cls,
GNUNET_break (0);
return;
}
- hello_builder = GNUNET_HELLO_builder_new (&record->peer);
- hello_exp = GNUNET_HELLO_builder_get_expiration_time (hello_builder,
hello);
- if (GNUNET_TIME_absolute_cmp (hello_exp, < , now))
+ hello_exp = GNUNET_HELLO_builder_get_expiration_time (hello);
+ if (GNUNET_TIME_absolute_cmp (hello_exp, <, now))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"HELLO for peer `%4s' has expired address, not suitable for
hostlist!\n",
GNUNET_i2s (&record->peer));
GNUNET_STATISTICS_update (stats,
gettext_noop (
- "Expired HELLO encountered
(ignored)"),
+ "Expired HELLO encountered (ignored)"),
1,
GNUNET_NO);
- GNUNET_HELLO_builder_free (hello_builder);
return;
}
}
@@ -258,7 +255,6 @@ host_processor (void *cls,
"bytes not included in hostlist (size limit)"),
s,
GNUNET_NO);
- GNUNET_HELLO_builder_free (hello_builder);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -267,7 +263,6 @@ host_processor (void *cls,
(unsigned int) s);
GNUNET_array_grow (builder->data, builder->size, old + s);
GNUNET_memcpy (&builder->data[old], hello, s);
- GNUNET_HELLO_builder_free (hello_builder);
}
diff --git a/src/include/gnunet_hello_uri_lib.h
b/src/include/gnunet_hello_uri_lib.h
index ec84f35b0..858b60793 100644
--- a/src/include/gnunet_hello_uri_lib.h
+++ b/src/include/gnunet_hello_uri_lib.h
@@ -120,13 +120,12 @@ GNUNET_HELLO_builder_from_url (const char *url);
/**
* Get the expiration time for this HELLO.
*
- * @param builder builder to serialize
* @param msg The hello msg.
* @return The expiration time.
*/
struct GNUNET_TIME_Absolute
-GNUNET_HELLO_builder_get_expiration_time (struct GNUNET_HELLO_Builder *builder,
- const struct GNUNET_MessageHeader
*msg);
+GNUNET_HELLO_builder_get_expiration_time (const struct
+ GNUNET_MessageHeader *msg);
/**
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] 40/40: Update to new transport binary, (continued)
- [gnunet] 40/40: Update to new transport binary, gnunet, 2023/10/05
- [gnunet] 10/40: TNG: Added Testcase that just runs two peers, and blocks., gnunet, 2023/10/05
- [gnunet] 14/40: NEWS: Added api to store hellos with peerstore service., gnunet, 2023/10/05
- [gnunet] 20/40: PEERSTORE: Moved code to scan and import hello file into peerstore from peerinfo., gnunet, 2023/10/05
- [gnunet] 26/40: Peerstore: Fixed bug in bootstrap code, gnunet, 2023/10/05
- [gnunet] 28/40: DHT: Fixed wrong group name, gnunet, 2023/10/05
- [gnunet] 11/40: CORE: Fixed bug that core is not calling GNUNET_TRANSPORT_core_receive_continue, gnunet, 2023/10/05
- [gnunet] 15/40: NEWS: Added api to get notified when hellos are stored with peerstore service., gnunet, 2023/10/05
- [gnunet] 08/40: TNG: Added generic start script for test cases., gnunet, 2023/10/05
- [gnunet] 21/40: NEWS: Moved code to testing to have more generic test setup, which can be used not only from within transport., gnunet, 2023/10/05
- [gnunet] 23/40: NEWS: Changed method GNUNET_HELLO_builder_get_expiration_time to not need parameter GNUNET_HELLO_Builder.,
gnunet <=
- [gnunet] 24/40: Peerstore: Changed the behavior of GNUNET_PEERSTORE_watch to also return the values allready stored for the key., gnunet, 2023/10/05
- [gnunet] 27/40: TNG: Fixed validation bug., gnunet, 2023/10/05
- [gnunet] 35/40: Remove old transport struct definitions, gnunet, 2023/10/05
- [gnunet] 04/40: NEWS: Removed all usage of old transport api, beside peerinfo tool, gnunet-transport cli and usage in transport layer itself., gnunet, 2023/10/05
- [gnunet] 34/40: Remove most of old transport, ATS and PEERINFO. Disable TESTBED and related tests, gnunet, 2023/10/05