Implement a bunch of clang-tidy suggested changes. Remove FilesystemLogger
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include <signal.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <argparse.hpp>
|
||||
#include <atomic>
|
||||
#include <csignal>
|
||||
#include <daggy/Server.hpp>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
@@ -38,6 +38,8 @@ void signalHandler(int signal)
|
||||
case SIGTERM:
|
||||
running = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +63,7 @@ void daemonize()
|
||||
sigaddset(&newSigSet, SIGTTOU); /* ignore Tty background writes */
|
||||
sigaddset(&newSigSet, SIGTTIN); /* ignore Tty background reads */
|
||||
sigprocmask(SIG_BLOCK, &newSigSet,
|
||||
NULL); /* Block the above specified signals */
|
||||
nullptr); /* Block the above specified signals */
|
||||
|
||||
/* Set up a signal handler */
|
||||
newSigAction.sa_handler = signalHandler;
|
||||
@@ -69,9 +71,9 @@ void daemonize()
|
||||
newSigAction.sa_flags = 0;
|
||||
|
||||
/* Signals to handle */
|
||||
sigaction(SIGHUP, &newSigAction, NULL); /* catch hangup signal */
|
||||
sigaction(SIGTERM, &newSigAction, NULL); /* catch term signal */
|
||||
sigaction(SIGINT, &newSigAction, NULL); /* catch interrupt signal */
|
||||
sigaction(SIGHUP, &newSigAction, nullptr); /* catch hangup signal */
|
||||
sigaction(SIGTERM, &newSigAction, nullptr); /* catch term signal */
|
||||
sigaction(SIGINT, &newSigAction, nullptr); /* catch interrupt signal */
|
||||
|
||||
// Fork once
|
||||
pid = fork();
|
||||
@@ -107,7 +109,7 @@ void daemonize()
|
||||
(void)rc;
|
||||
|
||||
/* Close all open file descriptors */
|
||||
for (auto x = sysconf(_SC_OPEN_MAX); x >= 0; x--) {
|
||||
for (int x = sysconf(_SC_OPEN_MAX); x >= 0; x--) {
|
||||
close(x);
|
||||
}
|
||||
}
|
||||
@@ -152,14 +154,14 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
bool verbose = args.get<bool>("--verbose");
|
||||
bool asDaemon = args.get<bool>("--daemon");
|
||||
std::string logFileName = args.get<std::string>("--log-file");
|
||||
std::string listenIP = args.get<std::string>("--ip");
|
||||
uint16_t listenPort = args.get<int>("--port");
|
||||
size_t executorThreads = args.get<size_t>("--executor-threads");
|
||||
size_t webThreads = args.get<size_t>("--web-threads");
|
||||
size_t dagThreads = args.get<size_t>("--dag-threads");
|
||||
bool verbose = args.get<bool>("--verbose");
|
||||
bool asDaemon = args.get<bool>("--daemon");
|
||||
auto logFileName = args.get<std::string>("--log-file");
|
||||
auto listenIP = args.get<std::string>("--ip");
|
||||
auto listenPort = args.get<int>("--port");
|
||||
auto executorThreads = args.get<size_t>("--executor-threads");
|
||||
auto webThreads = args.get<size_t>("--web-threads");
|
||||
auto dagThreads = args.get<size_t>("--dag-threads");
|
||||
|
||||
if (logFileName == "-") {
|
||||
if (asDaemon) {
|
||||
|
||||
Reference in New Issue
Block a user