Skip to content

Commit da569ea

Browse files
authored
http_server: v2: reload: windows: Enable hot reloading (#7984)
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]>
1 parent 2aa8cdc commit da569ea

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/http_server/api/v2/reload.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,27 @@ static void handle_reload_request(mk_request_t *request, struct flb_config *conf
5050
msgpack_pack_str_body(&mp_pck, "reload", 6);
5151

5252
#ifdef FLB_SYSTEM_WINDOWS
53-
ret = -1;
53+
if (config->enable_hot_reload != FLB_TRUE) {
54+
msgpack_pack_str(&mp_pck, 11);
55+
msgpack_pack_str_body(&mp_pck, "not enabled", 11);
56+
msgpack_pack_str(&mp_pck, 6);
57+
msgpack_pack_str_body(&mp_pck, "status", 6);
58+
msgpack_pack_int64(&mp_pck, -1);
59+
}
60+
else {
61+
ret = GenerateConsoleCtrlEvent(1 /* CTRL_BREAK_EVENT_1 */, 0);
62+
if (ret == 0) {
63+
mk_http_status(request, 500);
64+
mk_http_done(request);
65+
return;
66+
}
5467

55-
msgpack_pack_str(&mp_pck, 11);
56-
msgpack_pack_str_body(&mp_pck, "unsupported", 11);
57-
msgpack_pack_str(&mp_pck, 6);
58-
msgpack_pack_str_body(&mp_pck, "status", 6);
59-
msgpack_pack_int64(&mp_pck, ret);
68+
msgpack_pack_str(&mp_pck, 4);
69+
msgpack_pack_str_body(&mp_pck, "done", 4);
70+
msgpack_pack_str(&mp_pck, 6);
71+
msgpack_pack_str_body(&mp_pck, "status", 6);
72+
msgpack_pack_int64(&mp_pck, ret);
73+
}
6074
#else
6175
if (config->enable_hot_reload != FLB_TRUE) {
6276
msgpack_pack_str(&mp_pck, 11);

0 commit comments

Comments
 (0)