summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-08-07 08:41:57 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-08-07 08:41:57 -0700
commit37341048a9359cbaccf15ff3716b2e1ae55f4916 (patch)
tree0fcb7e55206c12796d5e047848f2592c906bc8a3 /main.cpp
parentb3491f9de18a4d3c029f4f9400b92337091d2274 (diff)
downloadinfinitytier-37341048a9359cbaccf15ff3716b2e1ae55f4916.tar.gz
infinitytier-37341048a9359cbaccf15ff3716b2e1ae55f4916.zip
Silence kextload/kextunload output, error handling improvements.
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index 153ced78..6485b8ff 100644
--- a/main.cpp
+++ b/main.cpp
@@ -707,6 +707,7 @@ int main(int argc,char **argv)
RoutingTable *routingTable = ZTCreatePlatformRoutingTable;
node = new Node(homeDir,tapFactory,routingTable,udpPort,tcpPort,needsReset);
+
switch(node->run()) {
#ifdef __WINDOWS__
case Node::NODE_RESTART_FOR_UPGRADE: {
@@ -739,18 +740,24 @@ int main(int argc,char **argv)
fprintf(stderr,"%s: abnormal termination: unable to execute update at %s\n",argv[0],(upgPath) ? upgPath : "(unknown path)");
} break;
#endif // __WINDOWS__ / __UNIX_LIKE__
+
case Node::NODE_UNRECOVERABLE_ERROR: {
exitCode = 3;
const char *termReason = node->reasonForTermination();
fprintf(stderr,"%s: abnormal termination: %s\n",argv[0],(termReason) ? termReason : "(unknown reason)");
} break;
+
default:
break;
}
+
delete node;
node = (Node *)0;
+ } catch ( std::exception &exc ) {
+ fprintf(stderr,"%s: unexpected exception: %s"ZT_EOL_S,argv[0],exc.what());
+ exitCode = 3;
} catch ( ... ) {
- fprintf(stderr,"%s: unexpected exception!"ZT_EOL_S,argv[0]);
+ fprintf(stderr,"%s: unexpected exception: unknown exception"ZT_EOL_S,argv[0]);
exitCode = 3;
}