This commit is contained in:
maliakal_d 2019-11-18 15:20:58 +01:00
parent dc78e23449
commit 5ce79ec9fa
2 changed files with 7 additions and 5 deletions

View File

@ -4,7 +4,6 @@
#include "logger.h"
#include "Receiver.h"
#include "sls_detector_defs.h"
#include "container_utils.h"
#include <csignal> //SIGINT
#include <cstdlib> //system

View File

@ -213,8 +213,13 @@ int main(int argc, char *argv[]) {
else if (pid == 0) {
cprintf(BLUE,"Child process %d [ Tid: %ld ]\n", i, (long)syscall(SYS_gettid));
Receiver *receiver = new Receiver(startTCPPort + i);
std::unique_ptr<Receiver> receiver = nullptr;
try {
receiver = sls::make_unique<Receiver>(startTCPPort + i);
} catch (...) {
FILE_LOG(logINFOBLUE) << "Exiting Child Process [ Tid: " << syscall(SYS_gettid) << " ]";
throw;
}
/** - register callbacks. remember to set file write enable to 0 (using the client)
if we should not write files and you will write data using the callbacks */
if (withCallback) {
@ -236,8 +241,6 @@ int main(int argc, char *argv[]) {
/** - as long as keeprunning is true (changes with Ctrl+C) */
while(keeprunning)
pause();
/** - interrupt caught, delete Receiver object and exit */
delete receiver;
cprintf(BLUE,"Exiting Child Process [ Tid: %ld ]\n", (long)syscall(SYS_gettid));
exit(EXIT_SUCCESS);
break;