(Continuation of a project which started a couple of weeks ago)
The backend now compiles, and sockets are working! Clients can connect to a socket set up by the backend, and receive its global state and send commands (such as setting configuration options and requesting the state)
- Backend now drops dead connections
- Each connection is given a mutex which protects that connection from being written to by multiple goroutines at once
- Writes to connections are given a deadline of 5 seconds, so slow or broken connections don’t hang the backend
- For data which is stored in the filesystem instead of in-memory (namely configuration and internal release data), create a
flockbefore attempting to write to it to prevent multiple goroutines writing to the same file at once - Clients can now set configuration settings via the socket. This also involved encapsulating each option with its own setter
- More errors get handled and propagated to the frontend (via release state) instead of crashing with
log.Fatal - Improved logging
- Generally more thread-safety w.r. to the socket
- Many other various, small performance/bug fixes
There’s lots still left to do, including propagating configuration/global/non-release-specific errors to the frontend, the automatic stuff on intervals, and the actual frontend, but I think the fact I’ve got working IPC is a good enough milestone to create a devlog
The attachment shows a connection to a running backend using socat, where after connecting I send the state command which results in me receiving the current global state of the backend. Then, I send a config command, enabling the “automatically check for updates” option, and then another state command to confirm that the configuration was indeed updated
Log in to leave a comment