Merge lp:~renatofilho/buteo-syncfw/fix-1509053 into lp:~phablet-team/buteo-syncfw/ubuntu

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Ken VanDine
Approved revision: 283
Merged at revision: 282
Proposed branch: lp:~renatofilho/buteo-syncfw/fix-1509053
Merge into: lp:~phablet-team/buteo-syncfw/ubuntu
Diff against target: 62 lines (+50/-0)
2 files modified
debian/patches/0004-Fixed-OOP-plugin-initialization.patch (+49/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~renatofilho/buteo-syncfw/fix-1509053
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Review via email: mp+275453@code.launchpad.net

Commit message

Fixed OOP plugin initialization.

Wait until the OOP plugin service appear on DBUS, to continue plugin initialization.

To post a comment you must log in.
283. By Renato Araujo Oliveira Filho

Updated patch based on upstream comments.

Revision history for this message
Ken VanDine (ken-vandine) wrote :

packaging is fine

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'debian/patches/0004-Fixed-OOP-plugin-initialization.patch'
--- debian/patches/0004-Fixed-OOP-plugin-initialization.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/0004-Fixed-OOP-plugin-initialization.patch 2015-10-28 11:57:36 +0000
@@ -0,0 +1,49 @@
1diff --git a/libbuteosyncfw/pluginmgr/PluginManager.cpp b/libbuteosyncfw/pluginmgr/PluginManager.cpp
2index c66f537..b4a0cb8 100644
3--- a/libbuteosyncfw/pluginmgr/PluginManager.cpp
4+++ b/libbuteosyncfw/pluginmgr/PluginManager.cpp
5@@ -658,13 +658,30 @@ QProcess* PluginManager::startOOPPlugin( const QString &aPath,
6 process->setProcessChannelMode( QProcess::ForwardedChannels );
7 process->start( aPath, args );
8
9- // This check is a workaround for the bug https://codereview.qt-project.org/#change,62897
10- QThread::sleep(1); // The process state does not seem be in a proper state immediately
11+ const QString clientPluginDBusServiceName(QStringLiteral("com.buteo.msyncd.plugin.profile-%1").arg(aProfileName));
12+ const QString serverPluginDBusServiceName(QStringLiteral("com.buteo.msyncd.plugin.%1").arg(aProfileName));
13+ bool pluginHasRegistered = false;
14+ for (int i = 0; i < 30; i++) { // wait for up to thirty seconds for the process to register with dbus
15+ QThread::sleep(1); // sleep for a second to wait for the process to be scheduled, init and register with dbus
16+ QDBusReply<bool> clientServiceRegistered = QDBusConnection::sessionBus().interface()->isServiceRegistered(clientPluginDBusServiceName);
17+ if (clientServiceRegistered.isValid() && clientServiceRegistered.value()) {
18+ pluginHasRegistered = true;
19+ break;
20+ }
21+ QDBusReply<bool> serverServiceRegistered = QDBusConnection::sessionBus().interface()->isServiceRegistered(serverPluginDBusServiceName);
22+ if (serverServiceRegistered.isValid() && serverServiceRegistered.value()) {
23+ pluginHasRegistered = true;
24+ break;
25+ }
26+ }
27+
28 if( process->state() == QProcess::Starting ) {
29 started = process->waitForStarted();
30+ } else {
31+ started = process->state() == QProcess::Running;
32 }
33
34- if (started == true) {
35+ if (started) {
36 DllInfo info;
37 info.iPath = aPath;
38 info.iHandle = (void*)process;
39@@ -675,6 +692,10 @@ QProcess* PluginManager::startOOPPlugin( const QString &aPath,
40 iDllLock.unlock();
41
42 LOG_DEBUG( "Process " << process->program() << " started with pid " << process->pid() );
43+ if (!pluginHasRegistered) {
44+ LOG_DEBUG( "Process " << process->program() << " with pid " << process->pid() <<
45+ "was unable to register DBus service: " << clientPluginDBusServiceName << "|" << serverPluginDBusServiceName );
46+ }
47 connect(process, SIGNAL(finished(int,QProcess::ExitStatus)),
48 this, SLOT(onProcessFinished(int,QProcess::ExitStatus)));
49 return process;
050
=== modified file 'debian/patches/series'
--- debian/patches/series 2015-09-22 16:15:11 +0000
+++ debian/patches/series 2015-10-28 11:57:36 +0000
@@ -3,3 +3,4 @@
30002-Fixed-FUNCTION_CALL_TRACE-macro.patch30002-Fixed-FUNCTION_CALL_TRACE-macro.patch
40003-Added-upstart-service-file.patch40003-Added-upstart-service-file.patch
50001-Check-for-WLAN-or-ETHERNET-connections.patch50001-Check-for-WLAN-or-ETHERNET-connections.patch
60004-Fixed-OOP-plugin-initialization.patch

Subscribers

People subscribed via source and target branches