~content-hub-team/content-hub/trunk

« back to all changes in this revision

Viewing changes to src/com/ubuntu/content/service/main.cpp

  • Committer: Tarmac
  • Author(s): Ken VanDine
  • Date: 2013-09-30 18:39:00 UTC
  • mfrom: (48.1.1 content-hub-lp1231368)
  • Revision ID: tarmac-20130930183900-61vw3dr45uph3six
Pulled back in all the changes that were reverted in rev 47.  Bug (LP: #1231368) seemed to be caused by gallery-app needing a rebuild against this version of content-hub.

Approved by PS Jenkins bot, Günter Schwann.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
#include <QCoreApplication>
20
20
#include <QDebug>
 
21
#include <csignal>
 
22
 
21
23
#include "detail/app_manager.h"
22
24
#include "common.h"
23
25
#include "registry.h"
45
47
            qDebug() << "PEER: " << r;
46
48
        }
47
49
    }
 
50
 
 
51
    void shutdown(int sig)
 
52
    {
 
53
        qDebug() << Q_FUNC_INFO << sig;
 
54
        QCoreApplication::instance()->quit();
 
55
    }
48
56
}
49
57
 
50
58
int main(int argc, char** argv)
74
82
        ret = 1;
75
83
    }
76
84
 
 
85
    std::signal(SIGTERM, shutdown);
 
86
    std::signal(SIGHUP, shutdown);
 
87
    std::signal(SIGKILL, shutdown);
 
88
    std::signal(SIGINT, shutdown);
 
89
 
77
90
    if (ret == 1)
78
91
        app->exit(ret);
79
92
    else
80
93
    {
81
94
        /* list known peers */
82
95
        list(registry);
83
 
        return app->exec();
 
96
        ret = app->exec();
84
97
    }
 
98
 
 
99
    qDebug() << "Server exiting, cleaning up";
 
100
    delete server;
 
101
    return ret;
85
102
}