fix: stop parliament accept starvation on outbound dial (0.9.22)

Peer dial used per-step read timeouts so a stuck handshake could block the
single-threaded daemon for tens of seconds; inbound hellos piled up unread
(CLOSE-WAIT). Use a wall-clock dial budget, drain accepts before each dial,
skip self, and only one side initiates idle polls.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WHC
2026-10-29 13:19:03 +08:00
co-authored by Cursor
parent 2f96b050d6
commit de2eaf87f7
5 changed files with 129 additions and 45 deletions
+1
View File
@@ -24,6 +24,7 @@ typedef struct {
} cst_peer_session_t;
/* Dial host:port, prove our cert, verify theirs, establish AEAD session.
* timeout_ms is a wall-clock budget for connect+handshake+kx (not per-read).
* Leaves sock open for post-handshake sync; call cst_peer_close. */
int cst_peer_dial(const char *host, int port, const cst_realm_cert_t *self,
const uint8_t self_sk[64], const uint8_t realm_pk[32],
+1 -1
View File
@@ -3,7 +3,7 @@
#define CST_VERSION_MAJOR 0
#define CST_VERSION_MINOR 9
#define CST_VERSION_PATCH 20
#define CST_VERSION_PATCH 22
#define CST_VERSION_STR_(x) #x
#define CST_VERSION_STR(x) CST_VERSION_STR_(x)