mirror of
https://github.com/kakwa/uts-server
synced 2025-02-10 20:53:28 +01:00
code reformatting
This commit is contained in:
parent
7f8d992f56
commit
d8f75a23f5
@ -1,4 +1,4 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
int http_server_start(char *conffile, char *conf_wd,bool stdout_dbg);
|
int http_server_start(char *conffile, char *conf_wd, bool stdout_dbg);
|
||||||
|
@ -64,16 +64,18 @@ int main(int argc, char **argv) {
|
|||||||
int ret = EXIT_SUCCESS;
|
int ret = EXIT_SUCCESS;
|
||||||
|
|
||||||
// get the current path, the configuration can be relative to this path
|
// get the current path, the configuration can be relative to this path
|
||||||
char conf_wd[PATH_MAX];
|
char conf_wd[PATH_MAX];
|
||||||
if (getcwd(conf_wd, sizeof(conf_wd)) == NULL){
|
if (getcwd(conf_wd, sizeof(conf_wd)) == NULL) {
|
||||||
syslog(LOG_CRIT, "unable to get the current, uts-server start failed");
|
syslog(LOG_CRIT, "unable to get the current, uts-server start failed");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.daemonize)
|
if (args.daemonize)
|
||||||
skeleton_daemon();
|
skeleton_daemon();
|
||||||
|
|
||||||
syslog(LOG_NOTICE, "uts-server daemon starting with conf '%s' from working dir '%s'", args.conffile, conf_wd);
|
syslog(LOG_NOTICE,
|
||||||
|
"uts-server daemon starting with conf '%s' from working dir '%s'",
|
||||||
|
args.conffile, conf_wd);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
ret = http_server_start(args.conffile, conf_wd, args.stdout_dbg);
|
ret = http_server_start(args.conffile, conf_wd, args.stdout_dbg);
|
||||||
|
@ -128,7 +128,7 @@ int rfc3161_handler(struct mg_connection *conn, void *context) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int http_server_start(char *conffile, char * conf_wd, bool stdout_dbg) {
|
int http_server_start(char *conffile, char *conf_wd, bool stdout_dbg) {
|
||||||
struct mg_context *ctx;
|
struct mg_context *ctx;
|
||||||
struct mg_callbacks callbacks;
|
struct mg_callbacks callbacks;
|
||||||
|
|
||||||
@ -147,8 +147,8 @@ int http_server_start(char *conffile, char * conf_wd, bool stdout_dbg) {
|
|||||||
mg_set_request_handler(ctx, "/", rfc3161_handler, (void *)ct);
|
mg_set_request_handler(ctx, "/", rfc3161_handler, (void *)ct);
|
||||||
|
|
||||||
// Wait until some signals are received
|
// Wait until some signals are received
|
||||||
while ( g_uts_sig == 0 ){
|
while (g_uts_sig == 0) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop the server.
|
// Stop the server.
|
||||||
|
@ -90,7 +90,7 @@ void skeleton_daemon() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Open the log file */
|
/* Open the log file */
|
||||||
//openlog("uts-server", LOG_PID, LOG_DAEMON);
|
// openlog("uts-server", LOG_PID, LOG_DAEMON);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_hex(rfc3161_context *ct, int priority, char *id,
|
void log_hex(rfc3161_context *ct, int priority, char *id,
|
||||||
@ -223,8 +223,8 @@ int set_params(rfc3161_context *ct, char *conf_file, char *conf_wd) {
|
|||||||
int http_counter = 0;
|
int http_counter = 0;
|
||||||
|
|
||||||
CONF *conf = load_config_file(ct, conf_file);
|
CONF *conf = load_config_file(ct, conf_file);
|
||||||
if(conf == NULL)
|
if (conf == NULL)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
// first pass to set the loglevel as soon as possible
|
// first pass to set the loglevel as soon as possible
|
||||||
for (int i = 0; i < RFC3161_OPTIONS_LEN; i++) {
|
for (int i = 0; i < RFC3161_OPTIONS_LEN; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user