Commit 01dea557 authored by Brendan Long's avatar Brendan Long

Move shutdown code into main.vala and make it more like the other projects.

parent 895bfa28
......@@ -35,6 +35,11 @@ static const OptionEntry[] options = {
{ null }
};
static MainLoop loop;
static void safe_exit(int signal) {
loop.quit();
}
internal static int main(string[] args) {
try {
var opt_context = new OptionContext("UPnP RemoteUIServer");
......@@ -62,6 +67,12 @@ internal static int main(string[] args) {
try {
RUI.RemoteUIServer server = new RUI.RemoteUIServer(config);
server.start();
loop = new MainLoop();
Posix.signal(Posix.SIGINT, safe_exit);
Posix.signal(Posix.SIGHUP, safe_exit);
Posix.signal(Posix.SIGTERM, safe_exit);
loop.run();
return 0;
} catch (Error e) {
stderr.printf("Error running RemoteUIServer: %s\n", e.message);
......
......@@ -68,13 +68,6 @@ public class RUI.RemoteUIServer {
"Unable to get %s.".printf(REMOTE_UI_SERVICE_TYPE));
}
service.action_invoked["GetCompatibleUIs"].connect(on_get_compatible_uis);
MainLoop loop = new MainLoop();
Unix.signal_add(Posix.SIGINT, () => {
loop.quit();
return true;
});
loop.run();
root_device.set_available(false);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment