From 5edddd5766fa4a93f739dcee989c28e7bd320a1f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 4 Aug 2018 21:17:43 -0700 Subject: [PATCH] trickle_handler: fix wrong sense of retval; add error option Add global variable handler_error; if handle_trickle() returns error, set message_from_host.handled to this. Default 1. --- sched/trickle_handler.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sched/trickle_handler.cpp b/sched/trickle_handler.cpp index 1f4ec3d330..07ad799f6c 100644 --- a/sched/trickle_handler.cpp +++ b/sched/trickle_handler.cpp @@ -48,10 +48,15 @@ char variety[256]; -// can change the following in handle_trickle_init() +// values of mhf.handled. +// Can change the following in handle_trickle_init() // int handled_enum = 0; + // enumerate messages with this int handled_set = 1; + // if successful, set to this +int handled_error = 1; + // if handling error, set to this // make one pass through trickle_ups with handled == handled_enum // return true if there were any @@ -73,12 +78,12 @@ bool do_trickle_scan() { break; } retval = handle_trickle(mfh); - if (!retval) { + if (retval) { log_messages.printf(MSG_CRITICAL, "handle_trickle(): %s", boincerror(retval) ); } - mfh.handled = handled_set; + mfh.handled = retval?handled_error:handled_set; mfh.update(); found = true; }