Commit Graph
11 Commits
Author SHA1 Message Date
Claude d56181503e Fix cluster not responding after restart
Two bugs prevented the cluster from working after a stop/start cycle:

1. tcp_listen_tcp() and tcp_listen_tls() had reuse_addr set to false,
   causing bind() to fail with EADDRINUSE when ports are in TIME_WAIT
   state after a restart. Set SO_REUSEADDR to true.

2. The vsr_boot_marker file (created in CWD on first boot) was never
   cleaned up on cluster stop. On restart, all nodes would enter
   STATUS_RECOVERY, but since RECOVERY messages are only processed by
   nodes in STATUS_NORMAL, the entire cluster would deadlock with no
   node able to recover. Remove the marker in cluster.sh stop.

https://claude.ai/code/session_01U72omHJrk95xFwm22Rkqgt
2026-02-26 01:02:21 +00:00
cozis 02da6b0170 Rewrite build scripts 2026-02-26 00:55:06 +01:00
cozis 0fbcbda4f7 Fix invalid write to static buffer in parse_addr_arg 2026-02-26 00:11:34 +01:00
cozis 7591ef6ee1 Cleanup of message.c/.h 2026-02-25 23:45:53 +01:00
cozis e38ad93da8 Cleanup of tcp.c/.h 2026-02-25 19:15:48 +01:00
cozisandClaude Opus 4.6 1b53abf633 Fix Windows networking bugs and connection metadata mismatch
- Use closesocket() instead of close() for sockets on Windows (lib/tcp.c)
- Call WSAStartup in tcp_init so outbound connections work (lib/tcp.c)
- Check WSAGetLastError() instead of errno for recv/send on Windows (lib/tcp.c)
- Use WSAEWOULDBLOCK instead of EINPROGRESS for non-blocking connect (lib/tcp.c)
- Add NULL guard in tcp_write for stale connection handles (lib/tcp.c)
- Fix ConnMetadata/TCP_Conn index mismatch in get_next_message: use
  event.handle.idx directly instead of searching for a free metadata
  slot, which could diverge when stale entries remain from failed
  outbound connections (lib/message.c)
- Initialize num_senders to 0 and skip unused metadata in
  find_conn_by_target (lib/message.c)
- Clear ready flag in http_server_next_request to prevent infinite
  loop (lib/http_server.c)
- Add CRT invalid parameter handler for the HTTP proxy (src/main.c)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 16:10:01 +01:00
cozisandClaude Opus 4.6 6b4f773052 Implement file_truncate for Windows and add missing Quakey mocks
file_truncate had a stub `return -1` on Windows, causing all
chunk_store_write calls to fail (every PUT returned TRANSFER_FAILED).
Implement it using SetFilePointer + SetEndOfFile.

Add mock_SetEndOfFile and mock_GetFileAttributesA to Quakey so the
simulation can exercise the Windows code paths against the mock
filesystem. Without these, SetEndOfFile was unmocked (link error) and
GetFileAttributesA called the real Win32 API on mock paths, making
chunk_store_exists always return false.

Verified: seeds 1-100 pass with 2000s simulation time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 13:33:18 +01:00
cozis 3da0eded42 First version of the HTTP proxy 2026-02-25 12:30:20 +01:00
cozis ef1d65ad2b Major refactoring 2026-02-25 10:44:43 +01:00
cozis 99b6c9dfcc Move files from lib/ into src/ and refactor the random client 2026-02-21 12:21:32 +01:00
cozis b64517c20e Full rewrite with VSR support 2026-02-20 16:55:29 +01:00