Files
@ 0729d364ca25
Branch filter:
Location: libtransport.git/backends/template/main.cpp - annotation
0729d364ca25
1.3 KiB
text/x-c++hdr
Fix double free in DummyConnectionServer
Do not create shared ptr from this as this lead to double free in
UserRegistryTest::login test. Shared ptr was needed to set event
owner in acceptConnection, actually it is never needed as events
are never filtered by owner. Thus it was removed and there is no
need to create shared ptr from this.
Do not create shared ptr from this as this lead to double free in
UserRegistryTest::login test. Shared ptr was needed to set event
owner in acceptConnection, actually it is never needed as events
are never filtered by owner. Thus it was removed and there is no
need to create shared ptr from this.
8b6068588621 8b6068588621 40d678184272 78e71f9345c7 78e71f9345c7 78e71f9345c7 40d678184272 40d678184272 40d678184272 40d678184272 15bdfab39ccf 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 4fe987b774d2 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 15bdfab39ccf ab2424659344 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 ab2424659344 40d678184272 40d678184272 40d678184272 40d678184272 40d678184272 15bdfab39ccf 40d678184272 40d678184272 40d678184272 40d678184272 ab2424659344 40d678184272 060510d6958e 060510d6958e 060510d6958e 060510d6958e 40d678184272 40d678184272 40d678184272 060510d6958e 40d678184272 40d678184272 8b6068588621 8b6068588621 40d678184272 40d678184272 40d678184272 | #include "plugin.h"
// Transport includes
#include "transport/Config.h"
#include "transport/NetworkPlugin.h"
#include "transport/Logging.h"
// Swiften
#include "Swiften/Swiften.h"
#ifndef _WIN32
// for signal handler
#include "unistd.h"
#include "signal.h"
#include "sys/wait.h"
#include "sys/signal.h"
#endif
// Boost
#include <boost/algorithm/string.hpp>
using namespace boost::filesystem;
using namespace boost::program_options;
using namespace Transport;
#ifndef _WIN32
static void spectrum_sigchld_handler(int sig)
{
int status;
pid_t pid;
do {
pid = waitpid(-1, &status, WNOHANG);
} while (pid != 0 && pid != (pid_t)-1);
if ((pid == (pid_t) - 1) && (errno != ECHILD)) {
char errmsg[BUFSIZ];
snprintf(errmsg, BUFSIZ, "Warning: waitpid() returned %d", pid);
perror(errmsg);
}
}
#endif
int main (int argc, char* argv[]) {
std::string host;
int port;
#ifndef _WIN32
if (signal(SIGCHLD, spectrum_sigchld_handler) == SIG_ERR) {
std::cout << "SIGCHLD handler can't be set\n";
return -1;
}
#endif
std::string error;
Config *cfg = Config::createFromArgs(argc, argv, error, host, port);
if (cfg == NULL) {
std::cerr << error;
return 1;
}
Logging::initBackendLogging(cfg);
Swift::SimpleEventLoop eventLoop;
Plugin p(cfg, &eventLoop, host, port);
eventLoop.run();
return 0;
}
|