chrgctrl.c:
Because have_warned_connect is shared between two threads (1 for each battery charge controller), if both charge controllers are unreachable, we will only warn about one missing. The warning will only be issued from the thread that gets to the charge controller comm check first, so it's also kind of a race condition.
To Reproduce
Steps to reproduce the behavior:
Ensure all charge controllers are disconnected from the network
Start mcp: sudo ./mcp -x | grep ctrl
Observe only 1 warning, either for 192.168.1.253 or 192.168.1.252, and that it varies from run to run.
Expected behavior
One one-time warning for each disconnected charge controller. Potential fix: remove the static keyword from have_warned_connect and have_warned_error too.
Environment info (please complete the following information):
Describe the bug
chrgctrl.c
: Becausehave_warned_connect
is shared between two threads (1 for each battery charge controller), if both charge controllers are unreachable, we will only warn about one missing. The warning will only be issued from the thread that gets to the charge controller comm check first, so it's also kind of a race condition.To Reproduce Steps to reproduce the behavior:
sudo ./mcp -x | grep ctrl
Expected behavior One one-time warning for each disconnected charge controller. Potential fix: remove the static keyword from
have_warned_connect
andhave_warned_error
too.Environment info (please complete the following information):