Skip to content

Commit

Permalink
http_server: v2: reload: windows: Enable hot reloading (#7984)
Browse files Browse the repository at this point in the history
Building on top of calyptia-fleet works on Windows,
we can also offer for enabling hot-reloading on Windows. :)

Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 authored and leonardo-albertovich committed Nov 3, 2023
1 parent c162498 commit 8647599
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/http_server/api/v2/reload.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,27 @@ static void handle_reload_request(mk_request_t *request, struct flb_config *conf
msgpack_pack_str_body(&mp_pck, "reload", 6);

#ifdef FLB_SYSTEM_WINDOWS
ret = -1;
if (config->enable_hot_reload != FLB_TRUE) {
msgpack_pack_str(&mp_pck, 11);
msgpack_pack_str_body(&mp_pck, "not enabled", 11);
msgpack_pack_str(&mp_pck, 6);
msgpack_pack_str_body(&mp_pck, "status", 6);
msgpack_pack_int64(&mp_pck, -1);
}
else {
ret = GenerateConsoleCtrlEvent(1 /* CTRL_BREAK_EVENT_1 */, 0);
if (ret == 0) {
mk_http_status(request, 500);
mk_http_done(request);
return;
}

msgpack_pack_str(&mp_pck, 11);
msgpack_pack_str_body(&mp_pck, "unsupported", 11);
msgpack_pack_str(&mp_pck, 6);
msgpack_pack_str_body(&mp_pck, "status", 6);
msgpack_pack_int64(&mp_pck, ret);
msgpack_pack_str(&mp_pck, 4);
msgpack_pack_str_body(&mp_pck, "done", 4);
msgpack_pack_str(&mp_pck, 6);
msgpack_pack_str_body(&mp_pck, "status", 6);
msgpack_pack_int64(&mp_pck, ret);
}
#else
if (config->enable_hot_reload != FLB_TRUE) {
msgpack_pack_str(&mp_pck, 11);
Expand Down

0 comments on commit 8647599

Please sign in to comment.