aboutsummaryrefslogtreecommitdiff
path: root/src/nse
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-05 15:10:46 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-05 15:10:46 +0000
commitaa79ba473f5351a046f870601524ba628aaa11b5 (patch)
tree7ac26e4d39a3785c59c36fbf4804bbd48754a1c5 /src/nse
parent08122e992e162831cc62fe7177030fec22712e71 (diff)
downloadgnunet-aa79ba473f5351a046f870601524ba628aaa11b5.tar.gz
gnunet-aa79ba473f5351a046f870601524ba628aaa11b5.zip
-try converting doubles to network byte order
Diffstat (limited to 'src/nse')
-rw-r--r--src/nse/gnunet-service-nse.c7
-rw-r--r--src/nse/nse_api.c3
2 files changed, 6 insertions, 4 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 6617fdfea..2b391b1c4 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -385,11 +385,12 @@ setup_estimate_message (struct GNUNET_NSE_ClientMessage *em)
385 em->header.type = htons (GNUNET_MESSAGE_TYPE_NSE_ESTIMATE); 385 em->header.type = htons (GNUNET_MESSAGE_TYPE_NSE_ESTIMATE);
386 em->reserved = htonl (0); 386 em->reserved = htonl (0);
387 em->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); 387 em->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
388 em->size_estimate = mean - 0.332747; 388 double se = mean - 0.332747;
389 nsize = log2 (GNUNET_CONTAINER_multihashmap_size (peers) + 1); 389 nsize = log2 (GNUNET_CONTAINER_multihashmap_size (peers) + 1);
390 if (em->size_estimate < nsize) 390 if (em->size_estimate < nsize)
391 em->size_estimate = nsize; 391 se = nsize;
392 em->std_deviation = std_dev; 392 em->size_estimate = GNUNET_hton_double (se);
393 em->std_deviation = GNUNET_hton_double (std_dev);
393 GNUNET_STATISTICS_set (stats, "# nodes in the network (estimate)", 394 GNUNET_STATISTICS_set (stats, "# nodes in the network (estimate)",
394 (uint64_t) pow (2, mean - 1.0 / 3.0), GNUNET_NO); 395 (uint64_t) pow (2, mean - 1.0 / 3.0), GNUNET_NO);
395} 396}
diff --git a/src/nse/nse_api.c b/src/nse/nse_api.c
index db5e9d117..4d5f6bb71 100644
--- a/src/nse/nse_api.c
+++ b/src/nse/nse_api.c
@@ -120,7 +120,8 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
120 } 120 }
121 client_msg = (const struct GNUNET_NSE_ClientMessage *) msg; 121 client_msg = (const struct GNUNET_NSE_ClientMessage *) msg;
122 h->recv_cb (h->recv_cb_cls, GNUNET_TIME_absolute_ntoh (client_msg->timestamp), 122 h->recv_cb (h->recv_cb_cls, GNUNET_TIME_absolute_ntoh (client_msg->timestamp),
123 client_msg->size_estimate, client_msg->std_deviation); 123 GNUNET_ntoh_double (client_msg->size_estimate),
124 GNUNET_ntoh_double (client_msg->std_deviation));
124 GNUNET_CLIENT_receive (h->client, &message_handler, h, 125 GNUNET_CLIENT_receive (h->client, &message_handler, h,
125 GNUNET_TIME_UNIT_FOREVER_REL); 126 GNUNET_TIME_UNIT_FOREVER_REL);
126} 127}