diff -r 99a34860c105 -r d938228c382e src/server/daemon/srvctrl.c --- a/src/server/daemon/srvctrl.c Wed Nov 02 19:19:01 2022 +0100 +++ b/src/server/daemon/srvctrl.c Sun Nov 06 15:53:32 2022 +0100 @@ -37,22 +37,23 @@ #include "../util/systhr.h" -#include -#include +#include +#include +#include #include "srvctrl.h" #define SRVCTRL_THREAD_STACKSIZE 8192 static int srvctrl; -static sstr_t srvctrl_path; +static cxmutstr srvctrl_path; static WSBool srv_shutdown; int srvctrl_init(ServerConfiguration *cfg) { // create srvctrl unix domain socket // this socket is used for stop, reconfigure and other operations - srvctrl_path = ucx_sprintf("%s/private/srvctrl.sock", cfg->tmp.ptr); + srvctrl_path = cx_asprintf("%s/private/srvctrl.sock", cfg->tmp.ptr); struct sockaddr_un addr; if(srvctrl_path.length > sizeof(addr.sun_path)-1) { log_ereport( @@ -148,7 +149,8 @@ log_add_logdup(&log); char buf[64]; - UcxBuffer *line = ucx_buffer_new(NULL, 32, UCX_BUFFER_AUTOEXTEND); + CxBuffer line; + cxBufferInit(&line, NULL, 32, cxDefaultAllocator, CX_BUFFER_AUTO_EXTEND|CX_BUFFER_FREE_CONTENTS); ssize_t r; WSBool br = FALSE; @@ -156,13 +158,13 @@ for(int i=0;ispace, line->pos); + cxmutstr ln = cx_mutstrn(line.space, line.pos); if(srvctrl_handle_cmd(client, ln)) { br = TRUE; break; } } else { - ucx_buffer_putc(line, c); + cxBufferPut(&line, c); } } if(br) { @@ -171,25 +173,25 @@ } log_remove_logdup(&log); - ucx_buffer_free(line); + cxBufferDestroy(&line); close(client->fd); free(client); return NULL; } -int srvctrl_handle_cmd(SrvCtrlClient *client, sstr_t cmd) { - if(!sstrcmp(cmd, S("reconfig"))) { +int srvctrl_handle_cmd(SrvCtrlClient *client, cxmutstr cmd) { + if(!cx_strcmp(cx_strcast(cmd), cx_str("reconfig"))) { log_ereport(LOG_INFORM, "reconfigure server"); if(webserver_reconfig()) { log_ereport(LOG_FAILURE, "cannot reload config"); } else { log_ereport(LOG_INFORM, "reconfig: success"); } - } else if(!sstrcmp(cmd, S("shutdown"))) { + } else if(!cx_strcmp(cx_strcast(cmd), cx_str("shutdown"))) { webserver_shutdown(); - } else if(!sstrcmp(cmd, S("stat"))) { + } else if(!cx_strcmp(cx_strcast(cmd), cx_str("stat"))) { // TODO: implement - } else if(!sstrcmp(cmd, S("log"))) { + } else if(!cx_strcmp(cx_strcast(cmd), cx_str("log"))) { return 0; } else { log_ereport(