diff options
Diffstat (limited to 'src/service/peerstore/peerstore_api_monitor.c')
-rw-r--r-- | src/service/peerstore/peerstore_api_monitor.c | 12 |
1 files changed, 9 insertions, 3 deletions
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) |