-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow jsonrpc for plugin suspend/resume #1799
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -589,7 +589,7 @@ namespace Plugin { | |
result->Message = _T("There is no callsign: ") + callSign; | ||
} | ||
} | ||
} | ||
} | ||
} else if (index.Current() == _T("Unavailable")) { | ||
if (index.Next()) { | ||
const string callSign(index.Current().Text()); | ||
|
@@ -918,7 +918,6 @@ namespace Plugin { | |
if (_pluginServer->Services().FromIdentifier(callsign, service) == Core::ERROR_NONE) { | ||
ASSERT(service.IsValid()); | ||
result = service->Deactivate(PluginHost::IShell::REQUESTED); | ||
|
||
// Normalise return code | ||
if ((result != Core::ERROR_NONE) && (result != Core::ERROR_ILLEGAL_STATE) && (result != Core::ERROR_INPROGRESS)) { | ||
result = Core::ERROR_CLOSING_FAILED; | ||
|
@@ -966,7 +965,7 @@ namespace Plugin { | |
{ | ||
Core::hresult result = Core::ERROR_NONE; | ||
ASSERT(_pluginServer != nullptr); | ||
|
||
if (callsign != Callsign()) { | ||
Core::ProxyType<PluginHost::IShell> service; | ||
|
||
|
@@ -979,6 +978,7 @@ namespace Plugin { | |
} | ||
else { | ||
result = stateControl->Request(PluginHost::IStateControl::command::SUSPEND); | ||
NotifySuspendResumeStateChange(callsign, Exchange::Controller::ILifeTime::state::SUSPENDED); | ||
stateControl->Release(); | ||
} | ||
} | ||
|
@@ -989,7 +989,6 @@ namespace Plugin { | |
else { | ||
result = Core::ERROR_PRIVILIGED_REQUEST; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
|
@@ -1010,6 +1009,7 @@ namespace Plugin { | |
} | ||
else { | ||
result = stateControl->Request(PluginHost::IStateControl::command::RESUME); | ||
NotifySuspendResumeStateChange(callsign, Exchange::Controller::ILifeTime::state::RESUMED); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is too early, we can only do so if the state is indeed changed. You know that if you would subscribe to the IStateControl::INotification interface. What if the Suspend or Resume fails ? |
||
stateControl->Release(); | ||
} | ||
} | ||
|
@@ -1347,24 +1347,36 @@ namespace Plugin { | |
|
||
return (Core::ERROR_NONE); | ||
} | ||
|
||
void Controller::NotifyStateChange(const string& callsign, const PluginHost::IShell::state& state, const PluginHost::IShell::reason& reason) | ||
{ | ||
_adminLock.Lock(); | ||
|
||
LifeTimeNotifiers::const_iterator index = _lifeTimeObservers.begin(); | ||
|
||
while(index != _lifeTimeObservers.end()) { | ||
(*index)->StateChange(callsign, state, reason); | ||
index++; | ||
} | ||
|
||
_adminLock.Unlock(); | ||
|
||
// also notify the JSON RPC listeners (if any) | ||
Exchange::Controller::JLifeTime::Event::StateChange(*this, callsign, state, reason); | ||
} | ||
|
||
void Controller::NotifySuspendResumeStateChange(const string& callsign, const Exchange::Controller::ILifeTime::state& state) | ||
{ | ||
_adminLock.Lock(); | ||
|
||
LifeTimeNotifiers::const_iterator index = _lifeTimeObservers.begin(); | ||
while(index != _lifeTimeObservers.end()) { | ||
(*index)->SuspendResumeStateChange(callsign, state); | ||
index++; | ||
} | ||
|
||
_adminLock.Unlock(); | ||
// also notify the JSON RPC listeners (if any) | ||
Exchange::Controller::JLifeTime::Event::SuspendResumeStateChange(*this, callsign, state); | ||
} | ||
|
||
Core::hresult Controller::BuildInfo(IMetadata::Data::BuildInfo& buildInfo) const | ||
{ | ||
#if defined(__WINDOWS__) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is too early, we can only do so if the state is indeed changed. You know that if you would subscribe to the IStateControl::INotification interface. What if the Suspend or Resume fails ?
Lets have a broader discussion on this if we want this as this has some severe impact..