diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-10-29 12:32:57 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-10-29 12:32:57 +0100 |
commit | 17f5db6f7c8d60930367738b3d872fbf891486ee (patch) | |
tree | 52e6362a319a417c813876f36733b4bdc567593a /src | |
parent | d10108c802b56535b03597e9fbb7603b0eeef9c0 (diff) |
allow MST callback to distinguish between disconnect and parse error situations, and only log for the hard errors
Diffstat (limited to 'src')
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnels.c | 4 | ||||
-rw-r--r-- | src/conversation/gnunet-helper-audio-playback-gst.c | 5 | ||||
-rw-r--r-- | src/conversation/gnunet-helper-audio-playback.c | 5 | ||||
-rw-r--r-- | src/conversation/gnunet_gst.c | 5 | ||||
-rw-r--r-- | src/conversation/microphone.c | 4 | ||||
-rw-r--r-- | src/core/gnunet-service-core.c | 3 | ||||
-rw-r--r-- | src/core/gnunet-service-core_kx.c | 3 | ||||
-rw-r--r-- | src/fs/fs_dirmetascan.c | 3 | ||||
-rw-r--r-- | src/include/gnunet_mst_lib.h | 4 | ||||
-rw-r--r-- | src/statistics/gnunet-service-statistics.c | 4 | ||||
-rw-r--r-- | src/testbed/gnunet-helper-testbed.c | 7 | ||||
-rw-r--r-- | src/transport/gnunet-helper-transport-wlan-dummy.c | 6 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 2 | ||||
-rw-r--r-- | src/util/client.c | 8 | ||||
-rw-r--r-- | src/util/mst.c | 29 | ||||
-rw-r--r-- | 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 22e19ef70a..fb91a4a6ae 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 264b14e763..002fed6c74 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 4344e1d418..18f63ad186 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 52cb2ccbc5..828b350770 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 7871433a33..11468fc59f 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 625bf9655a..214f729043 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 8a7cada5c5..ae0ae508f6 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 7b9f178fdc..8a3e37b491 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 7a1ca7a55a..fe6524eb32 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 0cb136b997..87e966a01d 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 392f257dd9..9601e75677 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 63ed9c4b79..f02d8bdd72 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 d9fade44f4..6a9c1b0bab 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 90bc837d73..138b1cfddb 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 4c2a74212c..5e472965f9 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 d9daaa7e21..bdc6381769 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, |