diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2024-02-25 19:44:50 +0100 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2024-02-25 19:44:50 +0100 |
commit | dd0a5ec1cc0f39026993883aa5980eae526f5ce8 (patch) | |
tree | 2aeb25091594133c6d74b9016cad4e80e80c115a | |
parent | 2bf23f075a55fb534c008f80e1ce020c613f7d74 (diff) | |
download | gnunet-dd0a5ec1cc0f39026993883aa5980eae526f5ce8.tar.gz gnunet-dd0a5ec1cc0f39026993883aa5980eae526f5ce8.zip |
PEERSTORE: Fix peerstore monitor RPC
-rw-r--r-- | src/service/peerstore/peerstore_api.c | 3 | ||||
-rw-r--r-- | src/service/peerstore/peerstore_api_monitor.c | 12 | ||||
-rw-r--r-- | src/service/transport/gnunet-service-transport.c | 7 |
3 files changed, 19 insertions, 3 deletions
diff --git a/src/service/peerstore/peerstore_api.c b/src/service/peerstore/peerstore_api.c index 3b945928a..19cb1213e 100644 --- a/src/service/peerstore/peerstore_api.c +++ b/src/service/peerstore/peerstore_api.c | |||
@@ -889,6 +889,9 @@ hello_add_iter (void *cls, const struct GNUNET_PEERSTORE_Record *record, | |||
889 | } | 889 | } |
890 | if (GNUNET_TIME_absolute_cmp (record->expiry, >, hello_exp)) | 890 | if (GNUNET_TIME_absolute_cmp (record->expiry, >, hello_exp)) |
891 | { | 891 | { |
892 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
893 | "Not storing hello for %s since we seem to have a newer version on record.\n", | ||
894 | GNUNET_i2s (&huc->pid)); | ||
892 | huc->cont (huc->cont_cls, GNUNET_OK); | 895 | huc->cont (huc->cont_cls, GNUNET_OK); |
893 | GNUNET_PEERSTORE_iteration_stop (huc->ic); | 896 | GNUNET_PEERSTORE_iteration_stop (huc->ic); |
894 | GNUNET_free (huc->hello); | 897 | GNUNET_free (huc->hello); |
diff --git a/src/service/peerstore/peerstore_api_monitor.c b/src/service/peerstore/peerstore_api_monitor.c index 8badb43eb..fff0b3eb0 100644 --- a/src/service/peerstore/peerstore_api_monitor.c +++ b/src/service/peerstore/peerstore_api_monitor.c | |||
@@ -198,6 +198,7 @@ reconnect (struct GNUNET_PEERSTORE_Monitor *mc) | |||
198 | struct GNUNET_MQ_Envelope *env; | 198 | struct GNUNET_MQ_Envelope *env; |
199 | struct PeerstoreMonitorStartMessage *sm; | 199 | struct PeerstoreMonitorStartMessage *sm; |
200 | size_t key_len = 0; | 200 | size_t key_len = 0; |
201 | size_t ss_size = 0; | ||
201 | 202 | ||
202 | if (NULL != mc->mq) | 203 | if (NULL != mc->mq) |
203 | { | 204 | { |
@@ -213,9 +214,11 @@ reconnect (struct GNUNET_PEERSTORE_Monitor *mc) | |||
213 | return; | 214 | return; |
214 | if (NULL != mc->key) | 215 | if (NULL != mc->key) |
215 | key_len = strlen (mc->key) + 1; | 216 | key_len = strlen (mc->key) + 1; |
217 | if (NULL != mc->sub_system) | ||
218 | ss_size = strlen (mc->sub_system) + 1; | ||
216 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending MONITOR_START\n"); | 219 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending MONITOR_START\n"); |
217 | env = GNUNET_MQ_msg_extra (sm, | 220 | env = GNUNET_MQ_msg_extra (sm, |
218 | htons (key_len), | 221 | htons (key_len) + htons (ss_size), |
219 | GNUNET_MESSAGE_TYPE_PEERSTORE_MONITOR_START); | 222 | GNUNET_MESSAGE_TYPE_PEERSTORE_MONITOR_START); |
220 | sm->iterate_first = htons (mc->iterate_first); | 223 | sm->iterate_first = htons (mc->iterate_first); |
221 | if (NULL != mc->peer) | 224 | if (NULL != mc->peer) |
@@ -223,8 +226,11 @@ reconnect (struct GNUNET_PEERSTORE_Monitor *mc) | |||
223 | sm->peer = *mc->peer; | 226 | sm->peer = *mc->peer; |
224 | sm->peer_set = htons (GNUNET_YES); | 227 | sm->peer_set = htons (GNUNET_YES); |
225 | } | 228 | } |
229 | if (NULL != mc->sub_system) | ||
230 | GNUNET_memcpy (&sm[1], mc->sub_system, ss_size); | ||
231 | sm->sub_system_size = htons (ss_size); | ||
226 | if (NULL != mc->key) | 232 | if (NULL != mc->key) |
227 | GNUNET_memcpy (&sm[1], mc->key, key_len); | 233 | GNUNET_memcpy (((char*) &sm[1]) + ss_size, mc->key, key_len); |
228 | sm->key_size = htons (key_len); | 234 | sm->key_size = htons (key_len); |
229 | GNUNET_MQ_send (mc->mq, env); | 235 | GNUNET_MQ_send (mc->mq, env); |
230 | } | 236 | } |
@@ -255,7 +261,7 @@ GNUNET_PEERSTORE_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
255 | mc->key = key; | 261 | mc->key = key; |
256 | mc->peer = peer; | 262 | mc->peer = peer; |
257 | mc->iterate_first = iterate_first; | 263 | mc->iterate_first = iterate_first; |
258 | mc->sub_system = sub_system; | 264 | mc->sub_system = GNUNET_strdup (sub_system); |
259 | mc->cfg = cfg; | 265 | mc->cfg = cfg; |
260 | reconnect (mc); | 266 | reconnect (mc); |
261 | if (NULL == mc->mq) | 267 | if (NULL == mc->mq) |
diff --git a/src/service/transport/gnunet-service-transport.c b/src/service/transport/gnunet-service-transport.c index 6d2ba4139..344f46f1e 100644 --- a/src/service/transport/gnunet-service-transport.c +++ b/src/service/transport/gnunet-service-transport.c | |||
@@ -5750,6 +5750,13 @@ store_pi (void *cls) | |||
5750 | GNUNET_free (address_uri); | 5750 | GNUNET_free (address_uri); |
5751 | return; | 5751 | return; |
5752 | } | 5752 | } |
5753 | else | ||
5754 | { | ||
5755 | |||
5756 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
5757 | "Storing our address `%s'\n", | ||
5758 | address_uri); | ||
5759 | } | ||
5753 | // FIXME hello_mono_time used here?? What about expiration in ale? | 5760 | // FIXME hello_mono_time used here?? What about expiration in ale? |
5754 | GNUNET_HELLO_sign_address (ale->address, | 5761 | GNUNET_HELLO_sign_address (ale->address, |
5755 | ale->nt, | 5762 | ale->nt, |