~stacyharper/bonsai

502519635f36efcfaf8787fe02d4cff2e14bc074 — Stacy Harper 13 days ago a89d145
Restart delay transition after reseting up the pipes
1 files changed, 9 insertions(+), 4 deletions(-)

M cmd/bonsaid/socket.ha
M cmd/bonsaid/socket.ha => cmd/bonsaid/socket.ha +9 -4
@@ 117,18 117,23 @@ fn dispatch(serv: *server) bool = {
			return false;
		};
		if (serv.pollfd[2].revents & event::POLLIN != 0) {
			if (bonsai::sync_back_wait_child(&serv.state, false)) {
				bonsai::state_forward_available_transitions(&serv.state);
				bonsai::trigger_delay_transition(&serv.state);
			};
			const synced = bonsai::sync_back_wait_child(&serv.state, false);

			const wait_pipes = serv.state.wait_pipes as (io::file, io::file);
			io::close(wait_pipes.0)!;
			io::close(wait_pipes.1)!;

			if (synced) {
				bonsai::state_forward_available_transitions(&serv.state);
			};

			serv.state.wait_pipes = unix::pipe(unix::pipe_flag::NONBLOCK)!;
			const wait_pipes = serv.state.wait_pipes as (io::file, io::file);

			if (synced) {
				bonsai::trigger_delay_transition(&serv.state);
			};

			serv.pollfd[2].fd = wait_pipes.0;
		};
		for (let i = POLLFD_RESERVED; i < len(serv.pollfd); i += 1) {