I committed a number of updates to the VLIB and Decider repos today, which should help in the following areas:
- Changed the way send() is called, preventing SIGPIPE signals from being emitted. This should let the send() call handle broken pipes by returning 0, which is handled in the code and should trigger a proper shutdown of the socket and a reconnection.
- Changed the way the formula processing function handles registration of interested parties of VINTs, specifically adding a parameter to request a specific trigger type when linking. This was necessary in the case of Torx pegs that were registering themselves as being interested in VINTs used for Conditions and/or Inhibitors. The problem that was happening was that because they were registered as Refresh On Change (the old default) if a CONDI VINT was changed, the peg would get refreshed, causing it to execute it's commands if CONDI was met. In some cases, this would cause a peg to get re-invoked MANY times, even though it should not. Now TORX pegs register themselves with the TRIGGER_NONE type, so that it can check the value of the given VINT in CONDI at the time of peg invocation, if CONDI is met [at that time] the commands will execute, but if not then nothing further will happen until the next scheduled invocation of that peg.
- Tweaked the keepalive parameters in the Websockets part of the code. I looked at including a heartbeat system in websockets to send, say, the current unix timestamp at regular intervals to keep the connection open if there is no VINT updates or ui commands being transferred. Previously it would simply disconnect the idle socket. Even as I write this however, I can see that it did not appear to have the desired effect and the clients still disconnect after a period of inactivity. I guess a proper heartbeat will be required after all, though maybe it can be initiated from the client end. Clients can "request" the current time and Decider will respond, confirming bidirectional communication is functional in the socket.