Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Unified Diff: src/main.cc

Issue 4304002: cashew: don't invoke D-Bus methods from within a D-Bus handler (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git@master
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/device.cc ('k') | src/service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/main.cc
diff --git a/src/main.cc b/src/main.cc
index 28186534237fc0946cacc73e8a4073401617b6b3..9d233975e5338c1719897d76e82b9b428fb7f1f5 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -21,6 +21,10 @@
namespace cashew {
+static const int kMillisecondsPerSecond = 1000;
+static const int kDBusConnectionTimeoutMilliseconds =
+ 1 * kMillisecondsPerSecond;
+
typedef int Signal;
typedef void (*SignalHandler)(Signal signal);
@@ -119,6 +123,7 @@ int main(int argc, char *argv[]) {
DLOG(INFO) << "creating service manager";
DBus::Connection client_conn = DBus::Connection::SystemBus();
+ client_conn.set_timeout(cashew::kDBusConnectionTimeoutMilliseconds);
cashew::service_manager = new(std::nothrow) cashew::ServiceManager(
client_conn);
if (cashew::service_manager == NULL) {
@@ -131,6 +136,7 @@ int main(int argc, char *argv[]) {
// TODO(vlaviano): can we share a single conn for client and server roles?
DBus::Connection server_conn = DBus::Connection::SystemBus();
server_conn.request_name(cashew::CashewServer::kServiceName);
+ server_conn.set_timeout(cashew::kDBusConnectionTimeoutMilliseconds);
cashew::server = new(std::nothrow) cashew::CashewServer(server_conn,
cashew::service_manager);
if (cashew::server == NULL) {
« no previous file with comments | « src/device.cc ('k') | src/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698