diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-01-22 15:52:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-01-22 15:52:40 +0000 |
commit | 48436941449d867ef9a32ddf29439c5017d37775 (patch) | |
tree | a34b1230ba7e4d2e9deea743dcfdb283f7f7b605 /src/statistics | |
parent | 87487477c67697355c79d2fe079d23a5b31c7ab6 (diff) | |
download | gnunet-48436941449d867ef9a32ddf29439c5017d37775.tar.gz gnunet-48436941449d867ef9a32ddf29439c5017d37775.zip |
stuff
Diffstat (limited to 'src/statistics')
-rw-r--r-- | src/statistics/gnunet-service-statistics.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/statistics/gnunet-service-statistics.c b/src/statistics/gnunet-service-statistics.c index c90038e03..428ce932f 100644 --- a/src/statistics/gnunet-service-statistics.c +++ b/src/statistics/gnunet-service-statistics.c | |||
@@ -218,16 +218,15 @@ transmit (struct GNUNET_SERVER_TransmitContext *tc, | |||
218 | const struct StatsEntry *e) | 218 | const struct StatsEntry *e) |
219 | { | 219 | { |
220 | struct GNUNET_STATISTICS_ReplyMessage *m; | 220 | struct GNUNET_STATISTICS_ReplyMessage *m; |
221 | struct GNUNET_MessageHeader *h; | ||
222 | size_t size; | 221 | size_t size; |
223 | uint16_t msize; | ||
224 | 222 | ||
225 | size = | 223 | size = |
226 | sizeof (struct GNUNET_STATISTICS_ReplyMessage) + strlen (e->service) + 1 + | 224 | sizeof (struct GNUNET_STATISTICS_ReplyMessage) + strlen (e->service) + 1 + |
227 | strlen (e->name) + 1; | 225 | strlen (e->name) + 1; |
228 | GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE); | 226 | GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE); |
229 | msize = size - sizeof (struct GNUNET_MessageHeader); | ||
230 | m = GNUNET_malloc (size); | 227 | m = GNUNET_malloc (size); |
228 | m->header.type = htons (GNUNET_MESSAGE_TYPE_STATISTICS_VALUE); | ||
229 | m->header.size = htons (size); | ||
231 | m->uid = htonl (e->uid); | 230 | m->uid = htonl (e->uid); |
232 | if (e->persistent) | 231 | if (e->persistent) |
233 | m->uid |= htonl (GNUNET_STATISTICS_PERSIST_BIT); | 232 | m->uid |= htonl (GNUNET_STATISTICS_PERSIST_BIT); |
@@ -241,11 +240,7 @@ transmit (struct GNUNET_SERVER_TransmitContext *tc, | |||
241 | "Transmitting value for `%s:%s': %llu\n", | 240 | "Transmitting value for `%s:%s': %llu\n", |
242 | e->service, e->name, e->value); | 241 | e->service, e->name, e->value); |
243 | #endif | 242 | #endif |
244 | h = &m->header; | 243 | GNUNET_SERVER_transmit_context_append_message (tc, &m->header); |
245 | GNUNET_SERVER_transmit_context_append (tc, | ||
246 | &h[1], | ||
247 | msize, | ||
248 | GNUNET_MESSAGE_TYPE_STATISTICS_VALUE); | ||
249 | GNUNET_free (m); | 244 | GNUNET_free (m); |
250 | } | 245 | } |
251 | 246 | ||
@@ -303,8 +298,8 @@ handle_get (void *cls, | |||
303 | transmit (tc, pos); | 298 | transmit (tc, pos); |
304 | pos = pos->next; | 299 | pos = pos->next; |
305 | } | 300 | } |
306 | GNUNET_SERVER_transmit_context_append (tc, NULL, 0, | 301 | GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0, |
307 | GNUNET_MESSAGE_TYPE_STATISTICS_END); | 302 | GNUNET_MESSAGE_TYPE_STATISTICS_END); |
308 | GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL); | 303 | GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL); |
309 | } | 304 | } |
310 | 305 | ||