[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: fix mem leak (when streamin
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: fix mem leak (when streaming large data streams) |
Date: |
Wed, 27 Jun 2018 19:17:41 +0200 |
This is an automated email from the git hooks/post-receive script.
xrs pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 599e34dd2 fix mem leak (when streaming large data streams)
new 9b5123a9f Merge branch 'master' of ssh://gnunet.org/gnunet
599e34dd2 is described below
commit 599e34dd2a9e5b60547c00b667f6675f9739c84a
Author: xrs <address@hidden>
AuthorDate: Wed Jun 27 19:16:02 2018 +0200
fix mem leak (when streaming large data streams)
---
src/cadet/gnunet-cadet.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c
index 67cebf02b..4fedf1c05 100644
--- a/src/cadet/gnunet-cadet.c
+++ b/src/cadet/gnunet-cadet.c
@@ -27,6 +27,8 @@
#include "gnunet_cadet_service.h"
#include "cadet.h"
+#define STREAM_BUFFER_SIZE 1024 // Pakets
+//#define STREAM_BUFFER_SIZE 5*1024*1024 // 5 MB
/**
* Option -P.
@@ -123,6 +125,8 @@ static struct GNUNET_SCHEDULER_Task *rd_task;
*/
static struct GNUNET_SCHEDULER_Task *job;
+static unsigned int sent_pkt;
+
/**
* Wait for input on STDIO and send it out over the #ch.
@@ -228,6 +232,12 @@ shutdown_task (void *cls)
}
}
+void *
+mq_cb(void *cls)
+{
+ listen_stdio ();
+}
+
/**
* Task run in stdio mode, after some data is available at stdin.
@@ -248,6 +258,8 @@ read_stdio (void *cls)
60000);
if (data_size < 1)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "read() returned %s\n", strerror(errno));
GNUNET_SCHEDULER_shutdown();
return;
}
@@ -262,9 +274,21 @@ read_stdio (void *cls)
data_size);
GNUNET_MQ_send (GNUNET_CADET_get_mq (ch),
env);
+
+ sent_pkt++;
+
if (GNUNET_NO == echo)
{
- listen_stdio ();
+ // Use MQ's notification if the data of stdin is pooring in too fast.
+ if (STREAM_BUFFER_SIZE < sent_pkt)
+ {
+ GNUNET_MQ_notify_sent (env, mq_cb, cls);
+ sent_pkt = 0;
+ }
+ else
+ {
+ listen_stdio ();
+ }
}
else
{
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: fix mem leak (when streaming large data streams),
gnunet <=