summaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht_nse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-service-dht_nse.c')
-rw-r--r--src/dht/gnunet-service-dht_nse.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/dht/gnunet-service-dht_nse.c b/src/dht/gnunet-service-dht_nse.c
index d59d46dd3..07ebb5299 100644
--- a/src/dht/gnunet-service-dht_nse.c
+++ b/src/dht/gnunet-service-dht_nse.c
@@ -11,12 +11,12 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20 20
21/** 21/**
22 * @file dht/gnunet-service-dht_nse.c 22 * @file dht/gnunet-service-dht_nse.c
@@ -52,14 +52,14 @@ static struct GNUNET_NSE_Handle *nse;
52 * 52 *
53 */ 53 */
54static void 54static void
55update_network_size_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp, 55update_network_size_estimate(void *cls, struct GNUNET_TIME_Absolute timestamp,
56 double logestimate, double std_dev) 56 double logestimate, double std_dev)
57{ 57{
58 GNUNET_STATISTICS_update (GDS_stats, 58 GNUNET_STATISTICS_update(GDS_stats,
59 gettext_noop ("# Network size estimates received"), 59 gettext_noop("# Network size estimates received"),
60 1, GNUNET_NO); 60 1, GNUNET_NO);
61 /* do not allow estimates < 0.5 */ 61 /* do not allow estimates < 0.5 */
62 log_of_network_size_estimate = GNUNET_MAX (0.5, logestimate); 62 log_of_network_size_estimate = GNUNET_MAX(0.5, logestimate);
63} 63}
64 64
65 65
@@ -69,7 +69,7 @@ update_network_size_estimate (void *cls, struct GNUNET_TIME_Absolute timestamp,
69 * @return log of NSE 69 * @return log of NSE
70 */ 70 */
71double 71double
72GDS_NSE_get () 72GDS_NSE_get()
73{ 73{
74 return log_of_network_size_estimate; 74 return log_of_network_size_estimate;
75} 75}
@@ -79,24 +79,24 @@ GDS_NSE_get ()
79 * Initialize NSE subsystem. 79 * Initialize NSE subsystem.
80 */ 80 */
81void 81void
82GDS_NSE_init () 82GDS_NSE_init()
83{ 83{
84 unsigned long long hops; 84 unsigned long long hops;
85 85
86 if ( (GNUNET_YES == 86 if ((GNUNET_YES ==
87 GNUNET_CONFIGURATION_have_value (GDS_cfg, 87 GNUNET_CONFIGURATION_have_value(GDS_cfg,
88 "dht", 88 "dht",
89 "FORCE_NSE")) && 89 "FORCE_NSE")) &&
90 (GNUNET_OK == 90 (GNUNET_OK ==
91 GNUNET_CONFIGURATION_get_value_number (GDS_cfg, 91 GNUNET_CONFIGURATION_get_value_number(GDS_cfg,
92 "dht", 92 "dht",
93 "FORCE_NSE", 93 "FORCE_NSE",
94 &hops)) ) 94 &hops)))
95 { 95 {
96 log_of_network_size_estimate = (double) hops; 96 log_of_network_size_estimate = (double)hops;
97 return; 97 return;
98 } 98 }
99 nse = GNUNET_NSE_connect (GDS_cfg, &update_network_size_estimate, NULL); 99 nse = GNUNET_NSE_connect(GDS_cfg, &update_network_size_estimate, NULL);
100} 100}
101 101
102 102
@@ -104,13 +104,13 @@ GDS_NSE_init ()
104 * Shutdown NSE subsystem. 104 * Shutdown NSE subsystem.
105 */ 105 */
106void 106void
107GDS_NSE_done () 107GDS_NSE_done()
108{ 108{
109 if (NULL != nse) 109 if (NULL != nse)
110 { 110 {
111 GNUNET_NSE_disconnect (nse); 111 GNUNET_NSE_disconnect(nse);
112 nse = NULL; 112 nse = NULL;
113 } 113 }
114} 114}
115 115
116/* end of gnunet-service-dht_nse.c */ 116/* end of gnunet-service-dht_nse.c */