aboutsummaryrefslogtreecommitdiff
path: root/src/nse
diff options
context:
space:
mode:
authorAlessio Vanni <vannilla@firemail.cc>2020-05-14 16:03:10 +0200
committerChristian Grothoff <christian@grothoff.org>2020-05-19 02:41:47 +0200
commitf4771fcc1c3fda21a46d0cb85d8b29e012254696 (patch)
tree012df74ed2cf44cb20605b239e1b88dab6edc645 /src/nse
parent6a52ce5f9bc35a852b215e7073f3a0d2665ca8de (diff)
downloadgnunet-f4771fcc1c3fda21a46d0cb85d8b29e012254696.tar.gz
gnunet-f4771fcc1c3fda21a46d0cb85d8b29e012254696.zip
Improved BIO API
BIO now supports reading from and writing to in-memory buffers. For reading, an allocated buffer (array) and a size is passed as arguments to the function opening the handle. For writing, a GNUNET_Buffer is created and used internally. The buffer contents can be extracted using the relevant function. There is a new API in addition to the existing read/write: this new API is more "declarative" in nature and is meant to mimic APIs like GNUNET_SQ. The read/write operations are defined in an array of specs which are then "commited" in a single (non-atomic) operation, rather than explicitly executing multiple function calls and checking their return value. Also there are small changes to GNUNET_Buffer to account for BIO's new features. Signed-off-by: Christian Grothoff <christian@grothoff.org>
Diffstat (limited to 'src/nse')
-rw-r--r--src/nse/gnunet-service-nse.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 793f60694..411f533a5 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -1001,7 +1001,7 @@ handle_p2p_estimate (void *cls,
1001 if (NULL != lh) 1001 if (NULL != lh)
1002 GNUNET_TESTBED_LOGGER_write (lh, &t, sizeof(uint64_t)); 1002 GNUNET_TESTBED_LOGGER_write (lh, &t, sizeof(uint64_t));
1003 if (NULL != histogram) 1003 if (NULL != histogram)
1004 GNUNET_BIO_write_int64 (histogram, t); 1004 GNUNET_BIO_write_int64 (histogram, "histogram-time", t);
1005 } 1005 }
1006#endif 1006#endif
1007 GNUNET_STATISTICS_update (stats, "# flood messages received", 1, GNUNET_NO); 1007 GNUNET_STATISTICS_update (stats, "# flood messages received", 1, GNUNET_NO);
@@ -1299,7 +1299,7 @@ shutdown_task (void *cls)
1299 } 1299 }
1300 if (NULL != histogram) 1300 if (NULL != histogram)
1301 { 1301 {
1302 GNUNET_BIO_write_close (histogram); 1302 GNUNET_BIO_write_close (histogram, NULL);
1303 histogram = NULL; 1303 histogram = NULL;
1304 } 1304 }
1305#endif 1305#endif
@@ -1453,7 +1453,7 @@ run (void *cls,
1453 GNUNET_assert ( 1453 GNUNET_assert (
1454 0 < GNUNET_asprintf (&histogram_fn, "%s/timestamps", histogram_dir)); 1454 0 < GNUNET_asprintf (&histogram_fn, "%s/timestamps", histogram_dir));
1455 GNUNET_free (histogram_dir); 1455 GNUNET_free (histogram_dir);
1456 histogram = GNUNET_BIO_write_open (histogram_fn); 1456 histogram = GNUNET_BIO_write_open_file (histogram_fn);
1457 if (NULL == histogram) 1457 if (NULL == histogram)
1458 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1458 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1459 "Unable to open histogram file `%s'\n", 1459 "Unable to open histogram file `%s'\n",