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 | |
parent | d10108c802b56535b03597e9fbb7603b0eeef9c0 (diff) | |
download | gnunet-17f5db6f7c8d60930367738b3d872fbf891486ee.tar.gz gnunet-17f5db6f7c8d60930367738b3d872fbf891486ee.zip |
allow MST callback to distinguish between disconnect and parse error situations, and only log for the hard errors
-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 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, | |||
2856 | * | 2856 | * |
2857 | * @param cls the `struct CadetTunnel` that got the message | 2857 | * @param cls the `struct CadetTunnel` that got the message |
2858 | * @param msg the message | 2858 | * @param msg the message |
2859 | * @return #GNUNET_OK (continue to process) | 2859 | * @return #GNUNET_OK on success (always) |
2860 | * #GNUNET_NO to stop further processing (no error) | ||
2861 | * #GNUNET_SYSERR to stop further processing with error | ||
2860 | */ | 2862 | */ |
2861 | static int | 2863 | static int |
2862 | handle_decrypted (void *cls, | 2864 | 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) | |||
221 | 221 | ||
222 | /** | 222 | /** |
223 | * Message callback | 223 | * Message callback |
224 | * | ||
225 | * @param msg message we received. | ||
226 | * @return #GNUNET_OK on success, | ||
227 | * #GNUNET_NO to stop further processing due to disconnect (no error) | ||
228 | * #GNUNET_SYSERR to stop further processing due to error | ||
224 | */ | 229 | */ |
225 | static int | 230 | static int |
226 | stdin_receiver (void *cls, | 231 | 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 () | |||
546 | 546 | ||
547 | /** | 547 | /** |
548 | * Message callback | 548 | * Message callback |
549 | * | ||
550 | * @param msg message we received. | ||
551 | * @return #GNUNET_OK on success, | ||
552 | * #GNUNET_NO to stop further processing due to disconnect (no error) | ||
553 | * #GNUNET_SYSERR to stop further processing due to error | ||
549 | */ | 554 | */ |
550 | static int | 555 | static int |
551 | stdin_receiver (void *cls, | 556 | 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) | |||
649 | 649 | ||
650 | /** | 650 | /** |
651 | * Message callback | 651 | * Message callback |
652 | * | ||
653 | * @param msg message we received. | ||
654 | * @return #GNUNET_OK on success, | ||
655 | * #GNUNET_NO to stop further processing due to disconnect (no error) | ||
656 | * #GNUNET_SYSERR to stop further processing due to error | ||
652 | */ | 657 | */ |
653 | static int | 658 | static int |
654 | stdin_receiver (void *cls, | 659 | 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 | |||
65 | * | 65 | * |
66 | * @param cls clsoure with our `struct Microphone` | 66 | * @param cls clsoure with our `struct Microphone` |
67 | * @param msg the message from the helper | 67 | * @param msg the message from the helper |
68 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 68 | * @return #GNUNET_OK on success, |
69 | * #GNUNET_NO to stop further processing (no error) | ||
70 | * #GNUNET_SYSERR to stop further processing with error | ||
69 | */ | 71 | */ |
70 | static int | 72 | static int |
71 | process_record_messages (void *cls, | 73 | 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 | |||
426 | * | 426 | * |
427 | * @param cls reservation request (`struct TokenizerContext`) | 427 | * @param cls reservation request (`struct TokenizerContext`) |
428 | * @param message the actual message | 428 | * @param message the actual message |
429 | * @return #GNUNET_OK on success, | ||
430 | * #GNUNET_NO to stop further processing (no error) | ||
431 | * #GNUNET_SYSERR to stop further processing with error | ||
429 | */ | 432 | */ |
430 | static int | 433 | static int |
431 | tokenized_cb (void *cls, | 434 | 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) | |||
708 | * | 708 | * |
709 | * @param cls the `struct GSC_KeyExchangeInfo` | 709 | * @param cls the `struct GSC_KeyExchangeInfo` |
710 | * @param m the message | 710 | * @param m the message |
711 | * @return #GNUNET_OK on success, | ||
712 | * #GNUNET_NO to stop further processing (no error) | ||
713 | * #GNUNET_SYSERR to stop further processing with error | ||
711 | */ | 714 | */ |
712 | static int | 715 | static int |
713 | deliver_message (void *cls, | 716 | 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) | |||
246 | * | 246 | * |
247 | * @param cls the closure (directory scanner object) | 247 | * @param cls the closure (directory scanner object) |
248 | * @param msg message from the helper process | 248 | * @param msg message from the helper process |
249 | * @return #GNUNET_OK on success, | ||
250 | * #GNUNET_NO to stop further processing (no error) | ||
251 | * #GNUNET_SYSERR to stop further processing with error | ||
249 | */ | 252 | */ |
250 | static int | 253 | static int |
251 | process_helper_msgs (void *cls, | 254 | 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; | |||
61 | * | 61 | * |
62 | * @param cls closure | 62 | * @param cls closure |
63 | * @param message the actual message | 63 | * @param message the actual message |
64 | * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing | 64 | * @return #GNUNET_OK on success, |
65 | * #GNUNET_NO to stop further processing due to disconnect (no error) | ||
66 | * #GNUNET_SYSERR to stop further processing due to error | ||
65 | */ | 67 | */ |
66 | typedef int | 68 | typedef int |
67 | (*GNUNET_MessageTokenizerCallback) (void *cls, | 69 | (*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, | |||
998 | * | 998 | * |
999 | * @param cls NULL | 999 | * @param cls NULL |
1000 | * @param message the message found on disk | 1000 | * @param message the message found on disk |
1001 | * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing | 1001 | * @return #GNUNET_OK on success, |
1002 | * #GNUNET_NO to stop further processing (no error) | ||
1003 | * #GNUNET_SYSERR to stop further processing with error | ||
1002 | */ | 1004 | */ |
1003 | static int | 1005 | static int |
1004 | inject_message (void *cls, | 1006 | 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) | |||
292 | * | 292 | * |
293 | * @param cls identification of the client | 293 | * @param cls identification of the client |
294 | * @param message the actual message | 294 | * @param message the actual message |
295 | * | 295 | * @return #GNUNET_OK on success, |
296 | * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing | 296 | * #GNUNET_NO to stop further processing (no error) |
297 | * #GNUNET_SYSERR to stop further processing with error | ||
297 | */ | 298 | */ |
298 | static int | 299 | static int |
299 | tokenizer_cb (void *cls, | 300 | tokenizer_cb (void *cls, |
@@ -359,7 +360,7 @@ tokenizer_cb (void *cls, | |||
359 | cfg = GNUNET_CONFIGURATION_create (); | 360 | cfg = GNUNET_CONFIGURATION_create (); |
360 | if (GNUNET_OK != | 361 | if (GNUNET_OK != |
361 | GNUNET_CONFIGURATION_deserialize (cfg, | 362 | GNUNET_CONFIGURATION_deserialize (cfg, |
362 | config, | 363 | config, |
363 | ul_config_size, | 364 | ul_config_size, |
364 | NULL)) | 365 | NULL)) |
365 | { | 366 | { |
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) | |||
121 | * | 121 | * |
122 | * @param cls the 'struct SendBuffer' to copy the converted message to | 122 | * @param cls the 'struct SendBuffer' to copy the converted message to |
123 | * @param hdr inbound message from the FIFO | 123 | * @param hdr inbound message from the FIFO |
124 | * @return #GNUNET_OK on success, | ||
125 | * #GNUNET_NO to stop further processing (no error) | ||
126 | * #GNUNET_SYSERR to stop further processing with error | ||
124 | */ | 127 | */ |
125 | static int | 128 | static int |
126 | stdin_send (void *cls, | 129 | stdin_send (void *cls, |
@@ -167,6 +170,9 @@ stdin_send (void *cls, | |||
167 | * | 170 | * |
168 | * @param cls the 'struct SendBuffer' to copy to | 171 | * @param cls the 'struct SendBuffer' to copy to |
169 | * @param hdr the message we received to copy to the buffer | 172 | * @param hdr the message we received to copy to the buffer |
173 | * @return #GNUNET_OK on success, | ||
174 | * #GNUNET_NO to stop further processing (no error) | ||
175 | * #GNUNET_SYSERR to stop further processing with error | ||
170 | */ | 176 | */ |
171 | static int | 177 | static int |
172 | file_in_send (void *cls, | 178 | 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, | |||
1651 | * | 1651 | * |
1652 | * @param cls current session as closure | 1652 | * @param cls current session as closure |
1653 | * @param message the message to be forwarded to transport service | 1653 | * @param message the message to be forwarded to transport service |
1654 | * @return #GNUNET_OK | 1654 | * @return #GNUNET_OK (all OK) |
1655 | */ | 1655 | */ |
1656 | static int | 1656 | static int |
1657 | server_receive_mst_cb (void *cls, | 1657 | 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) | |||
306 | * | 306 | * |
307 | * @param cls the `struct ClientState` | 307 | * @param cls the `struct ClientState` |
308 | * @param msg message we received. | 308 | * @param msg message we received. |
309 | * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing | 309 | * @return #GNUNET_OK on success, |
310 | * #GNUNET_NO to stop further processing due to disconnect (no error) | ||
311 | * #GNUNET_SYSERR to stop further processing due to error | ||
310 | */ | 312 | */ |
311 | static int | 313 | static int |
312 | recv_message (void *cls, | 314 | recv_message (void *cls, |
@@ -315,7 +317,7 @@ recv_message (void *cls, | |||
315 | struct ClientState *cstate = cls; | 317 | struct ClientState *cstate = cls; |
316 | 318 | ||
317 | if (GNUNET_YES == cstate->in_destroy) | 319 | if (GNUNET_YES == cstate->in_destroy) |
318 | return GNUNET_SYSERR; | 320 | return GNUNET_NO; |
319 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 321 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
320 | "Received message of type %u and size %u from %s\n", | 322 | "Received message of type %u and size %u from %s\n", |
321 | ntohs (msg->type), | 323 | ntohs (msg->type), |
@@ -324,7 +326,7 @@ recv_message (void *cls, | |||
324 | GNUNET_MQ_inject_message (cstate->mq, | 326 | GNUNET_MQ_inject_message (cstate->mq, |
325 | msg); | 327 | msg); |
326 | if (GNUNET_YES == cstate->in_destroy) | 328 | if (GNUNET_YES == cstate->in_destroy) |
327 | return GNUNET_SYSERR; | 329 | return GNUNET_NO; |
328 | return GNUNET_OK; | 330 | return GNUNET_OK; |
329 | } | 331 | } |
330 | 332 | ||
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, | |||
126 | int need_align; | 126 | int need_align; |
127 | unsigned long offset; | 127 | unsigned long offset; |
128 | int ret; | 128 | int ret; |
129 | int cbret; | ||
129 | 130 | ||
130 | GNUNET_assert (mst->off <= mst->pos); | 131 | GNUNET_assert (mst->off <= mst->pos); |
131 | GNUNET_assert (mst->pos <= mst->curr_buf); | 132 | GNUNET_assert (mst->pos <= mst->curr_buf); |
@@ -229,13 +230,15 @@ do_align: | |||
229 | if (one_shot == GNUNET_YES) | 230 | if (one_shot == GNUNET_YES) |
230 | one_shot = GNUNET_SYSERR; | 231 | one_shot = GNUNET_SYSERR; |
231 | mst->off += want; | 232 | mst->off += want; |
232 | if (GNUNET_SYSERR == mst->cb (mst->cb_cls, | 233 | if (GNUNET_OK != |
233 | hdr)) | 234 | (cbret = mst->cb (mst->cb_cls, |
235 | hdr))) | ||
234 | { | 236 | { |
235 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 237 | if (GNUNET_SYSERR == cbret) |
236 | "Failure processing message of type %u and size %u\n", | 238 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
237 | ntohs (hdr->type), | 239 | "Failure processing message of type %u and size %u\n", |
238 | ntohs (hdr->size)); | 240 | ntohs (hdr->type), |
241 | ntohs (hdr->size)); | ||
239 | return GNUNET_SYSERR; | 242 | return GNUNET_SYSERR; |
240 | } | 243 | } |
241 | if (mst->off == mst->pos) | 244 | if (mst->off == mst->pos) |
@@ -277,13 +280,15 @@ do_align: | |||
277 | } | 280 | } |
278 | if (one_shot == GNUNET_YES) | 281 | if (one_shot == GNUNET_YES) |
279 | one_shot = GNUNET_SYSERR; | 282 | one_shot = GNUNET_SYSERR; |
280 | if (GNUNET_SYSERR == mst->cb (mst->cb_cls, | 283 | if (GNUNET_OK != |
281 | hdr)) | 284 | (cbret = mst->cb (mst->cb_cls, |
285 | hdr))) | ||
282 | { | 286 | { |
283 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 287 | if (GNUNET_SYSERR == cbret) |
284 | "Failure processing message of type %u and size %u\n", | 288 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
285 | ntohs (hdr->type), | 289 | "Failure processing message of type %u and size %u\n", |
286 | ntohs (hdr->size)); | 290 | ntohs (hdr->type), |
291 | ntohs (hdr->size)); | ||
287 | return GNUNET_SYSERR; | 292 | return GNUNET_SYSERR; |
288 | } | 293 | } |
289 | buf += want; | 294 | 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, | |||
2218 | * | 2218 | * |
2219 | * @param cls closure, NULL | 2219 | * @param cls closure, NULL |
2220 | * @param message message we got from the client (VPN channel interface) | 2220 | * @param message message we got from the client (VPN channel interface) |
2221 | * @return #GNUNET_OK on success, | ||
2222 | * #GNUNET_NO to stop further processing (no error) | ||
2223 | * #GNUNET_SYSERR to stop further processing with error | ||
2221 | */ | 2224 | */ |
2222 | static int | 2225 | static int |
2223 | message_token (void *cls, | 2226 | message_token (void *cls, |