Skip to content

Commit 4e0151e

Browse files
thiagoralvesclaude
andcommitted
fix: Remove faulty client count optimization in S7Comm sync
The Srv_GetStatus client count check was incorrectly returning 0 even when clients were connected, causing buffer sync to be skipped. Remove this optimization to ensure buffer sync always happens. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5567362 commit 4e0151e

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

core/src/drivers/plugins/native/s7comm/s7comm_plugin.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,7 @@ extern "C" void cycle_start(void)
580580
/**
581581
* @brief Called at the end of each PLC scan cycle
582582
*
583-
* Optimization: If no clients are connected, skip sync entirely.
584-
*
585-
* Double-buffer sync strategy (when clients connected):
583+
* Double-buffer sync strategy:
586584
* 1. Lock S7 mutex (briefly)
587585
* 2. Copy S7 buffers -> shadow buffers (capture S7 client writes)
588586
* 3. Unlock S7 mutex
@@ -599,17 +597,6 @@ extern "C" void cycle_end(void)
599597
return;
600598
}
601599

602-
/* Check if any clients are connected - skip sync if none */
603-
int server_status = 0;
604-
int cpu_status = 0;
605-
int clients_count = 0;
606-
Srv_GetStatus(g_server, server_status, cpu_status, clients_count);
607-
608-
if (clients_count == 0) {
609-
/* No clients connected - no need to sync buffers */
610-
return;
611-
}
612-
613600
/*
614601
* Step 1: Lock S7 mutex and copy S7 -> shadow (capture S7 writes)
615602
* This captures what S7 clients have written to output/memory areas

0 commit comments

Comments
 (0)