From 827063bb1d4343e145a85ffa027baeb0f96ca831 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Sun, 29 Nov 2020 11:39:50 -0800
Subject: [PATCH] Copy event last-run info from global config into node config

Fixes issue introduced in last commit to this file (the each-node-has-its-own-config-in-memory enhancement) that would prevent users from logging in because their time was reduced for an upcoming event that had already run. The change assumes the event thread is running (its the thing that reads the event last-run info from time.dab). Thanks to mlong for the report.
---
 src/sbbs3/main.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index b9491edb30..672f0bfb47 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -5710,8 +5710,6 @@ NO_SSH:
 		scfg_t* cfg = &node_scfg[i - 1];
 		if(cfg->size != sizeof(*cfg) || (node.misc & NODE_RRUN)) {
 			sbbs->bprintf("Loading configuration...");
-			free_cfg(cfg);
-			free_text(node_text[i - 1]);
 			cfg->size = sizeof(*cfg);
 			cfg->node_num = i;
 		    SAFECOPY(cfg->ctrl_dir, startup->ctrl_dir);
@@ -5736,6 +5734,9 @@ NO_SSH:
 			}
 			sbbs->bputs(crlf);
 		}
+		// Copy event last-run info from global config
+		for(int e=0; e < cfg->total_events && e < scfg.total_events; e++)
+			cfg->event[e]->last = scfg.event[e]->last;
 
         node_socket[i-1]=client_socket;
 
-- 
GitLab