perf: accept thread + dial backoff; join/peers.json (0.9.23)

Run inbound peer handling on its own thread so outbound dials cannot starve
:9100. Failed peers cool down exponentially. Also land --join (member seat)
and realm/peers.json seed discovery for Tailscale meshes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
WHC
2026-10-29 18:16:46 +08:00
co-authored by Cursor
parent de2eaf87f7
commit c329db504d
7 changed files with 273 additions and 37 deletions
+34
View File
@@ -125,6 +125,40 @@ int cst_parliament_cli_login_and_serve(const char *password,
return 0;
}
int cst_parliament_cli_join_and_serve(const char *password,
const char *instance_id,
const char *device_label, int peer_port) {
char err[256], pwbuf[256];
const char *pw = password;
if ((!pw || !pw[0]) && resolve_password(pwbuf, sizeof(pwbuf), &pw) != 0)
return 1;
char *hand =
cst_parliament_seat_join(pw, instance_id, device_label, err, sizeof(err));
if (!hand) {
fprintf(stderr, "%s\n", err[0] ? err : "join failed");
if (pw == pwbuf)
memset(pwbuf, 0, sizeof(pwbuf));
return 1;
}
fputs(hand, stdout);
free(hand);
if (cst_parliament_daemon_start(pw, instance_id,
peer_port > 0 ? peer_port : 9100, err,
sizeof(err)) != 0) {
fprintf(stderr, "warning: service: %s (seat join still valid)\n",
err[0] ? err : "start failed");
printf("service=failed\n");
if (pw == pwbuf)
memset(pwbuf, 0, sizeof(pwbuf));
return 0;
}
if (cst_parliament_daemon_running())
printf("service=running\n");
if (pw == pwbuf)
memset(pwbuf, 0, sizeof(pwbuf));
return 0;
}
int cst_parliament_cli_service(const char *password, const char *instance_id,
int peer_port, int foreground) {
char err[256], pwbuf[256];