[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 19/64: allow MST callback to distinguish between d
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 19/64: allow MST callback to distinguish between disconnect and parse error situations, and only log for the hard errors |
Date: |
Sat, 30 Dec 2017 20:58:04 +0100 |
This is an automated email from the git hooks/post-receive script.
lurchi pushed a commit to branch master
in repository gnunet.
commit 17f5db6f7c8d60930367738b3d872fbf891486ee
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Oct 29 12:32:57 2017 +0100
allow MST callback to distinguish between disconnect and parse error
situations, and only log for the hard errors
---
src/cadet/gnunet-service-cadet_tunnels.c | 4 ++-
.../gnunet-helper-audio-playback-gst.c | 5 ++++
src/conversation/gnunet-helper-audio-playback.c | 5 ++++
src/conversation/gnunet_gst.c | 5 ++++
src/conversation/microphone.c | 4 ++-
src/core/gnunet-service-core.c | 3 +++
src/core/gnunet-service-core_kx.c | 3 +++
src/fs/fs_dirmetascan.c | 3 +++
src/include/gnunet_mst_lib.h | 4 ++-
src/statistics/gnunet-service-statistics.c | 4 ++-
src/testbed/gnunet-helper-testbed.c | 7 +++---
src/transport/gnunet-helper-transport-wlan-dummy.c | 6 +++++
src/transport/plugin_transport_http_server.c | 2 +-
src/util/client.c | 8 +++---
src/util/mst.c | 29 +++++++++++++---------
src/vpn/gnunet-service-vpn.c | 3 +++
16 files changed, 72 insertions(+), 23 deletions(-)
diff --git a/src/cadet/gnunet-service-cadet_tunnels.c
b/src/cadet/gnunet-service-cadet_tunnels.c
index 22e19ef70..fb91a4a6a 100644
--- a/src/cadet/gnunet-service-cadet_tunnels.c
+++ b/src/cadet/gnunet-service-cadet_tunnels.c
@@ -2856,7 +2856,9 @@ handle_plaintext_channel_destroy (void *cls,
*
* @param cls the `struct CadetTunnel` that got the message
* @param msg the message
- * @return #GNUNET_OK (continue to process)
+ * @return #GNUNET_OK on success (always)
+ * #GNUNET_NO to stop further processing (no error)
+ * #GNUNET_SYSERR to stop further processing with error
*/
static int
handle_decrypted (void *cls,
diff --git a/src/conversation/gnunet-helper-audio-playback-gst.c
b/src/conversation/gnunet-helper-audio-playback-gst.c
index 264b14e76..002fed6c7 100644
--- a/src/conversation/gnunet-helper-audio-playback-gst.c
+++ b/src/conversation/gnunet-helper-audio-playback-gst.c
@@ -221,6 +221,11 @@ feed_buffer_to_gst (const char *audio, size_t b_len)
/**
* Message callback
+ *
+ * @param msg message we received.
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing due to disconnect (no error)
+ * #GNUNET_SYSERR to stop further processing due to error
*/
static int
stdin_receiver (void *cls,
diff --git a/src/conversation/gnunet-helper-audio-playback.c
b/src/conversation/gnunet-helper-audio-playback.c
index 4344e1d41..18f63ad18 100644
--- a/src/conversation/gnunet-helper-audio-playback.c
+++ b/src/conversation/gnunet-helper-audio-playback.c
@@ -546,6 +546,11 @@ ogg_demux_and_decode ()
/**
* Message callback
+ *
+ * @param msg message we received.
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing due to disconnect (no error)
+ * #GNUNET_SYSERR to stop further processing due to error
*/
static int
stdin_receiver (void *cls,
diff --git a/src/conversation/gnunet_gst.c b/src/conversation/gnunet_gst.c
index 52cb2ccbc..828b35077 100644
--- a/src/conversation/gnunet_gst.c
+++ b/src/conversation/gnunet_gst.c
@@ -649,6 +649,11 @@ gnunet_read (GNUNET_gstData * d)
/**
* Message callback
+ *
+ * @param msg message we received.
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing due to disconnect (no error)
+ * #GNUNET_SYSERR to stop further processing due to error
*/
static int
stdin_receiver (void *cls,
diff --git a/src/conversation/microphone.c b/src/conversation/microphone.c
index 7871433a3..11468fc59 100644
--- a/src/conversation/microphone.c
+++ b/src/conversation/microphone.c
@@ -65,7 +65,9 @@ struct Microphone
*
* @param cls clsoure with our `struct Microphone`
* @param msg the message from the helper
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing (no error)
+ * #GNUNET_SYSERR to stop further processing with error
*/
static int
process_record_messages (void *cls,
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c
index 625bf9655..214f72904 100644
--- a/src/core/gnunet-service-core.c
+++ b/src/core/gnunet-service-core.c
@@ -426,6 +426,9 @@ struct TokenizerContext
*
* @param cls reservation request (`struct TokenizerContext`)
* @param message the actual message
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing (no error)
+ * #GNUNET_SYSERR to stop further processing with error
*/
static int
tokenized_cb (void *cls,
diff --git a/src/core/gnunet-service-core_kx.c
b/src/core/gnunet-service-core_kx.c
index 8a7cada5c..ae0ae508f 100644
--- a/src/core/gnunet-service-core_kx.c
+++ b/src/core/gnunet-service-core_kx.c
@@ -708,6 +708,9 @@ setup_fresh_ping (struct GSC_KeyExchangeInfo *kx)
*
* @param cls the `struct GSC_KeyExchangeInfo`
* @param m the message
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing (no error)
+ * #GNUNET_SYSERR to stop further processing with error
*/
static int
deliver_message (void *cls,
diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c
index 7b9f178fd..8a3e37b49 100644
--- a/src/fs/fs_dirmetascan.c
+++ b/src/fs/fs_dirmetascan.c
@@ -246,6 +246,9 @@ finish_scan (void *cls)
*
* @param cls the closure (directory scanner object)
* @param msg message from the helper process
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing (no error)
+ * #GNUNET_SYSERR to stop further processing with error
*/
static int
process_helper_msgs (void *cls,
diff --git a/src/include/gnunet_mst_lib.h b/src/include/gnunet_mst_lib.h
index 7a1ca7a55..fe6524eb3 100644
--- a/src/include/gnunet_mst_lib.h
+++ b/src/include/gnunet_mst_lib.h
@@ -61,7 +61,9 @@ struct GNUNET_MessageStreamTokenizer;
*
* @param cls closure
* @param message the actual message
- * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing due to disconnect (no error)
+ * #GNUNET_SYSERR to stop further processing due to error
*/
typedef int
(*GNUNET_MessageTokenizerCallback) (void *cls,
diff --git a/src/statistics/gnunet-service-statistics.c
b/src/statistics/gnunet-service-statistics.c
index 0cb136b99..87e966a01 100644
--- a/src/statistics/gnunet-service-statistics.c
+++ b/src/statistics/gnunet-service-statistics.c
@@ -998,7 +998,9 @@ client_disconnect_cb (void *cls,
*
* @param cls NULL
* @param message the message found on disk
- * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing (no error)
+ * #GNUNET_SYSERR to stop further processing with error
*/
static int
inject_message (void *cls,
diff --git a/src/testbed/gnunet-helper-testbed.c
b/src/testbed/gnunet-helper-testbed.c
index 392f257dd..9601e7567 100644
--- a/src/testbed/gnunet-helper-testbed.c
+++ b/src/testbed/gnunet-helper-testbed.c
@@ -292,8 +292,9 @@ child_death_task (void *cls)
*
* @param cls identification of the client
* @param message the actual message
- *
- * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing (no error)
+ * #GNUNET_SYSERR to stop further processing with error
*/
static int
tokenizer_cb (void *cls,
@@ -359,7 +360,7 @@ tokenizer_cb (void *cls,
cfg = GNUNET_CONFIGURATION_create ();
if (GNUNET_OK !=
GNUNET_CONFIGURATION_deserialize (cfg,
- config,
+ config,
ul_config_size,
NULL))
{
diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c
b/src/transport/gnunet-helper-transport-wlan-dummy.c
index 63ed9c4b7..f02d8bdd7 100644
--- a/src/transport/gnunet-helper-transport-wlan-dummy.c
+++ b/src/transport/gnunet-helper-transport-wlan-dummy.c
@@ -121,6 +121,9 @@ send_mac_to_plugin (char *buffer, struct
GNUNET_TRANSPORT_WLAN_MacAddress *mac)
*
* @param cls the 'struct SendBuffer' to copy the converted message to
* @param hdr inbound message from the FIFO
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing (no error)
+ * #GNUNET_SYSERR to stop further processing with error
*/
static int
stdin_send (void *cls,
@@ -167,6 +170,9 @@ stdin_send (void *cls,
*
* @param cls the 'struct SendBuffer' to copy to
* @param hdr the message we received to copy to the buffer
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing (no error)
+ * #GNUNET_SYSERR to stop further processing with error
*/
static int
file_in_send (void *cls,
diff --git a/src/transport/plugin_transport_http_server.c
b/src/transport/plugin_transport_http_server.c
index d9fade44f..6a9c1b0ba 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -1651,7 +1651,7 @@ server_send_callback (void *cls,
*
* @param cls current session as closure
* @param message the message to be forwarded to transport service
- * @return #GNUNET_OK
+ * @return #GNUNET_OK (all OK)
*/
static int
server_receive_mst_cb (void *cls,
diff --git a/src/util/client.c b/src/util/client.c
index 90bc837d7..138b1cfdd 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -306,7 +306,9 @@ transmit_ready (void *cls)
*
* @param cls the `struct ClientState`
* @param msg message we received.
- * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing due to disconnect (no error)
+ * #GNUNET_SYSERR to stop further processing due to error
*/
static int
recv_message (void *cls,
@@ -315,7 +317,7 @@ recv_message (void *cls,
struct ClientState *cstate = cls;
if (GNUNET_YES == cstate->in_destroy)
- return GNUNET_SYSERR;
+ return GNUNET_NO;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received message of type %u and size %u from %s\n",
ntohs (msg->type),
@@ -324,7 +326,7 @@ recv_message (void *cls,
GNUNET_MQ_inject_message (cstate->mq,
msg);
if (GNUNET_YES == cstate->in_destroy)
- return GNUNET_SYSERR;
+ return GNUNET_NO;
return GNUNET_OK;
}
diff --git a/src/util/mst.c b/src/util/mst.c
index 4c2a74212..5e472965f 100644
--- a/src/util/mst.c
+++ b/src/util/mst.c
@@ -126,6 +126,7 @@ GNUNET_MST_from_buffer (struct
GNUNET_MessageStreamTokenizer *mst,
int need_align;
unsigned long offset;
int ret;
+ int cbret;
GNUNET_assert (mst->off <= mst->pos);
GNUNET_assert (mst->pos <= mst->curr_buf);
@@ -229,13 +230,15 @@ do_align:
if (one_shot == GNUNET_YES)
one_shot = GNUNET_SYSERR;
mst->off += want;
- if (GNUNET_SYSERR == mst->cb (mst->cb_cls,
- hdr))
+ if (GNUNET_OK !=
+ (cbret = mst->cb (mst->cb_cls,
+ hdr)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Failure processing message of type %u and size %u\n",
- ntohs (hdr->type),
- ntohs (hdr->size));
+ if (GNUNET_SYSERR == cbret)
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Failure processing message of type %u and size %u\n",
+ ntohs (hdr->type),
+ ntohs (hdr->size));
return GNUNET_SYSERR;
}
if (mst->off == mst->pos)
@@ -277,13 +280,15 @@ do_align:
}
if (one_shot == GNUNET_YES)
one_shot = GNUNET_SYSERR;
- if (GNUNET_SYSERR == mst->cb (mst->cb_cls,
- hdr))
+ if (GNUNET_OK !=
+ (cbret = mst->cb (mst->cb_cls,
+ hdr)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Failure processing message of type %u and size %u\n",
- ntohs (hdr->type),
- ntohs (hdr->size));
+ if (GNUNET_SYSERR == cbret)
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Failure processing message of type %u and size %u\n",
+ ntohs (hdr->type),
+ ntohs (hdr->size));
return GNUNET_SYSERR;
}
buf += want;
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c
index d9daaa7e2..bdc638176 100644
--- a/src/vpn/gnunet-service-vpn.c
+++ b/src/vpn/gnunet-service-vpn.c
@@ -2218,6 +2218,9 @@ route_packet (struct DestinationEntry *destination,
*
* @param cls closure, NULL
* @param message message we got from the client (VPN channel interface)
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO to stop further processing (no error)
+ * #GNUNET_SYSERR to stop further processing with error
*/
static int
message_token (void *cls,
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 16/64: do handle CTRL-C properly in test_social, (continued)
- [GNUnet-SVN] [gnunet] 16/64: do handle CTRL-C properly in test_social, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 12/64: fix wrong condition, do only drop if it has not been dropped, instead of causing double-drop, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 11/64: Merge branch 'fix_social' of gnunet.org:gnunet into fix_social, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 20/64: Fix tcp on exit crash -- could have sworn I fixed this one before, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 21/64: Merge branch 'fix_social' of gnunet.org:gnunet into fix_social, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 25/64: Merge branch 'fix_social' of gnunet.org:gnunet into fix_social, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 35/64: added FIXMEs, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 32/64: commented out wrong message type, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 40/64: revert commit 6490b5f31e58e9ec008f8c5ceda28f6054f1bbba, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 23/64: improve documentation, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 19/64: allow MST callback to distinguish between disconnect and parse error situations, and only log for the hard errors,
gnunet <=
- [GNUnet-SVN] [gnunet] 36/64: added FIXME, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 31/64: Merge branch 'fix_social' of gnunet.org:gnunet into fix_social, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 26/64: finalize protocol change (fixes message loss when leaving a place), gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 47/64: Merge branch 'fix_social' of gnunet.org:gnunet into fix_social, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 39/64: WARNING -> DEBUG, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 37/64: mark channel as disconnectin when a part request is sent; cleanup, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 33/64: Merge branch 'fix_social' of gnunet.org:gnunet into fix_social, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 24/64: changed log levels, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 42/64: added logging, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 54/64: test_social: less services and less noise in the output, gnunet, 2017/12/30