From 435622df26f493520b2b1d5c01e1227a9df88536 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 22 Aug 2020 19:02:10 +0100 Subject: [PATCH] conditional logs --- src/cmdlistener.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/cmdlistener.rs b/src/cmdlistener.rs index 21ea5af2..dbf9dc50 100644 --- a/src/cmdlistener.rs +++ b/src/cmdlistener.rs @@ -261,6 +261,7 @@ fn execute(cs: &mut CommandStream, cmd: MgmtCommand) -> MgmtResponse { #[derive(Debug,Default)] struct UpdateHandlerBulk { pieces : slotmap::SparseSecondaryMap>, + logs : bool, } #[derive(Debug)] @@ -299,7 +300,7 @@ impl UpdateHandler { None => { bulk.pieces.remove(upiece); }, }; } - let _logs = ulogs; + bulk.logs |= ulogs.len() != 0; }, Online => { let estimate = upieces.len() + ulogs.len(); @@ -324,11 +325,13 @@ impl UpdateHandler { buf.piece_update(upiece, uuop, &lens); } - buf.log_updates(vec![LogEntry { - html: "The facilitator (re)configured the game".to_owned(), - // xxx use cs.desc - }]); - }, + if bulk.logs { + buf.log_updates(vec![LogEntry { + html: "The facilitator (re)configured the game".to_owned(), + // xxx use cs.desc + }]); + } + }, Online => { }, } } -- 2.30.2