From 4ef2089fd4e9e268b49ea0ecb628cd1aa919d3db Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Thu, 21 May 2026 13:16:38 +0000 Subject: [PATCH] fix(config-repl): wire handle_config_request() to send real bytes Replace NULL sha256/bytes stub with xce_replconfig_reply_raw() call. Primary now sends actual config blob and SHA-256 in OP_replConfig reply. --- src/controller/config_repl.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/controller/config_repl.c b/src/controller/config_repl.c index 1b1c6b64..71407518 100644 --- a/src/controller/config_repl.c +++ b/src/controller/config_repl.c @@ -23,6 +23,7 @@ #include "clusterconfig.h" #include "cluster.h" #include "ha.h" +#include "request.h" #include "utils.h" #include "wobj.h" #include "xce/cluster_def.h" @@ -649,21 +650,17 @@ int handle_config_request(cluster_t *c, endpoint_t *ep, xce_request_t *req) return -EIO; } - reply.status = 0; - rmsg->up_to_date = 0; - rmsg->version_tag = my_tag; - /* sha256 and bytes are xce_data_t* — raw-byte encoding is wired in Task 11. - * For now set to NULL so encode_Data_ptr emits capn_null pointers. - * The standby will fall through to its saved config on this path until - * Task 11 completes the typemap shims. */ - rmsg->sha256 = NULL; - rmsg->bytes = NULL; - - xce_reply(ep, c->myhost, &reply); + int rc2 = xce_replconfig_reply_raw(ep, c->myhost, req->seq, + my_tag, + recomputed, 32, + bytes, blen); free(bytes); + /* rmsg is no longer needed — xce_replconfig_reply_raw builds capnp directly */ free(rmsg); reply.data.replconfigreplymsg = NULL; - return 0; + if (rc2 != 0) + ERROR("handle_config_request: xce_replconfig_reply_raw failed: %d", rc2); + return rc2; } /* ── fetch_config_from_primary helpers ─────────────────────── */