Commit cf0063b8 authored by skummer's avatar skummer

ZP-115

- added: implemented call to ISearchProvider->TerminateSearch() triggered on save of the device manager using process loop detection data

git-svn-id: https://z-push.org/svn/z-push/trunk@1322 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 3eee00d7
...@@ -167,6 +167,12 @@ class DeviceManager { ...@@ -167,6 +167,12 @@ class DeviceManager {
} }
} }
// remove old search data
$oldpid = $this->loopdetection->ProcessLoopDetectionGetOutdatedSearchPID();
if ($oldpid) {
ZPush::GetBackend()->GetSearchProvider()->TerminateSearch($oldpid);
}
// we terminated this process // we terminated this process
if ($this->loopdetection) if ($this->loopdetection)
$this->loopdetection->ProcessLoopDetectionTerminate(); $this->loopdetection->ProcessLoopDetectionTerminate();
......
...@@ -263,6 +263,26 @@ class LoopDetection extends InterProcessData { ...@@ -263,6 +263,26 @@ class LoopDetection extends InterProcessData {
} }
} }
/**
* Gets the PID of an outdated search process
*
* Returns false if there isn't any process
*
* @access public
* @return boolean
*
*/
public function ProcessLoopDetectionGetOutdatedSearchPID() {
$stack = $this->getProcessStack();
if (count($stack) > 1) {
$se = $stack[0];
if ($se['cc'] == ZPush::COMMAND_SEARCH) {
return $se['pid'];
}
}
return false;
}
/** /**
* Inserts or updates the current process entry on the stack * Inserts or updates the current process entry on the stack
* *
......
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