summaryrefslogtreecommitdiffstats
path: root/synchronizer
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-03 09:01:05 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-03 09:01:05 +0100
commit4d9746c828558c9f872e0aed52442863affb25d5 (patch)
tree507d7c2ba67f47d3cbbcf01a722236ff1b48426b /synchronizer
parent9cea920b7dd51867a0be0fed2f461b6be73c103e (diff)
downloadsink-4d9746c828558c9f872e0aed52442863affb25d5.tar.gz
sink-4d9746c828558c9f872e0aed52442863affb25d5.zip
Fromatted the whole codebase with clang-format.
clang-format -i */**{.cpp,.h}
Diffstat (limited to 'synchronizer')
-rw-r--r--synchronizer/main.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/synchronizer/main.cpp b/synchronizer/main.cpp
index d7a18e2..02cf365 100644
--- a/synchronizer/main.cpp
+++ b/synchronizer/main.cpp
@@ -29,33 +29,31 @@
29#undef DEBUG_AREA 29#undef DEBUG_AREA
30#define DEBUG_AREA "resource" 30#define DEBUG_AREA "resource"
31 31
32void crashHandler(int sig) { 32void crashHandler(int sig)
33{
33 std::fprintf(stderr, "Error: signal %d\n", sig); 34 std::fprintf(stderr, "Error: signal %d\n", sig);
34 35
35 QString s; 36 QString s;
36 void *trace[256]; 37 void *trace[256];
37 int n = backtrace( trace, 256 ); 38 int n = backtrace(trace, 256);
38 if ( n ) { 39 if (n) {
39 char **strings = backtrace_symbols( trace, n ); 40 char **strings = backtrace_symbols(trace, n);
40 41
41 s = QLatin1String( "[\n" ); 42 s = QLatin1String("[\n");
42 43
43 for ( int i = 0; i < n; ++i ) { 44 for (int i = 0; i < n; ++i) {
44 s += QString::number( i ) + 45 s += QString::number(i) + QLatin1String(": ") + QLatin1String(strings[i]) + QLatin1String("\n");
45 QLatin1String( ": " ) +
46 QLatin1String( strings[i] ) + QLatin1String( "\n" );
47 } 46 }
48 s += QLatin1String( "]\n" ); 47 s += QLatin1String("]\n");
49 std::fprintf(stderr, "Backtrace: %s\n", s.toLatin1().data()); 48 std::fprintf(stderr, "Backtrace: %s\n", s.toLatin1().data());
50 49
51 if ( strings ) { 50 if (strings) {
52 free( strings ); 51 free(strings);
53 } 52 }
54
55 } 53 }
56 54
57 std::system("exec gdb -p \"$PPID\" -ex \"thread apply all bt\""); 55 std::system("exec gdb -p \"$PPID\" -ex \"thread apply all bt\"");
58 //This only works if we actually have xterm and X11 available 56 // This only works if we actually have xterm and X11 available
59 // std::system("exec xterm -e gdb -p \"$PPID\""); 57 // std::system("exec xterm -e gdb -p \"$PPID\"");
60 58
61 std::abort(); 59 std::abort();
@@ -63,7 +61,7 @@ void crashHandler(int sig) {
63 61
64int main(int argc, char *argv[]) 62int main(int argc, char *argv[])
65{ 63{
66 //For crashes 64 // For crashes
67 signal(SIGSEGV, crashHandler); 65 signal(SIGSEGV, crashHandler);
68 QCoreApplication app(argc, argv); 66 QCoreApplication app(argc, argv);
69 67
@@ -84,10 +82,8 @@ int main(int argc, char *argv[])
84 82
85 Listener *listener = new Listener(instanceIdentifier, &app); 83 Listener *listener = new Listener(instanceIdentifier, &app);
86 84
87 QObject::connect(&app, &QCoreApplication::aboutToQuit, 85 QObject::connect(&app, &QCoreApplication::aboutToQuit, listener, &Listener::closeAllConnections);
88 listener, &Listener::closeAllConnections); 86 QObject::connect(listener, &Listener::noClients, &app, &QCoreApplication::quit);
89 QObject::connect(listener, &Listener::noClients,
90 &app, &QCoreApplication::quit);
91 87
92 return app.exec(); 88 return app.exec();
93} 89}