Commit 8a34e439 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-698 fixed typo in memcached provider filename, when waiting for a

mutex only log up to 5 messages (spread over the configured total amount
of time), if memcache is down don't retry in other connections for up to
30 seconds (configurable), removed TCP_NODELAY and NO_BLOCK options,
memcache servers are setup in a single string, renamed ReInitSharedMem()
to ReInitIPC(), fixed comments and public/private/protected visibility,
fixed upper/lowercasing of method names, added some dots.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 3f17ba03
...@@ -42,10 +42,15 @@ ...@@ -42,10 +42,15 @@
* Consult LICENSE file for details * Consult LICENSE file for details
************************************************/ ************************************************/
// The list of available memcache servers // Comma separated list of available memcache servers.
// More servers can be added as 'hostname:port' // Servers can be added as 'hostname:port,otherhost:port'
// if no port is specified, the default port 11211 will be used define('MEMCACHED_SERVERS','localhost:11211');
$zpush_ipc_memcached_servers = array('localhost');
// Memcached down indicator
// In case memcached is not available, a lock file will be written to disk
define('MEMCACHED_DOWN_LOCK_FILE', '/tmp/z-push-memcache-down');
// indicates how long the lock file will be maintained (in seconds)
define('MEMCACHED_DOWN_LOCK_EXPIRATION', 30);
// Prefix to used for keys // Prefix to used for keys
define('MEMCACHED_PREFIX', 'z-push-ipc'); define('MEMCACHED_PREFIX', 'z-push-ipc');
...@@ -53,8 +58,8 @@ define('MEMCACHED_PREFIX', 'z-push-ipc'); ...@@ -53,8 +58,8 @@ define('MEMCACHED_PREFIX', 'z-push-ipc');
// Connection timeout in ms // Connection timeout in ms
define('MEMCACHED_TIMEOUT', 100); define('MEMCACHED_TIMEOUT', 100);
// Mutex timeout in s // Mutex timeout (in seconds)
define('MEMCACHED_MUTEX_TIMEOUT', 5); define('MEMCACHED_MUTEX_TIMEOUT', 5);
// Waiting time before re-trying to aquire mutext (in millionth of sec) // Waiting time before re-trying to aquire mutex (in ms), must be higher than 0
define('MEMCACHED_BLOCK_USLEEP', 10000); define('MEMCACHED_BLOCK_WAIT', 10);
...@@ -58,33 +58,33 @@ class IpcSharedMemoryProvider implements IIpcProvider { ...@@ -58,33 +58,33 @@ class IpcSharedMemoryProvider implements IIpcProvider {
$this->type = $type; $this->type = $type;
$this->allocate = $allocate; $this->allocate = $allocate;
if ($this->InitSharedMem()) if ($this->initSharedMem())
ZLog::Write(LOGLEVEL_DEBUG, sprintf("%s(): Initialized mutexid %s and memid %s.", $class, $this->mutexid, $this->memid)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("%s(): Initialized mutexid %s and memid %s.", $class, $this->mutexid, $this->memid));
} }
/** /**
* Allocates shared memory * Allocates shared memory.
* *
* @access private * @access private
* @return boolean * @return boolean
*/ */
private function InitSharedMem() { private function initSharedMem() {
if (!function_exists('sem_get') || !function_exists('shm_attach') || !function_exists('sem_acquire')|| !function_exists('shm_get_var')) { if (!function_exists('sem_get') || !function_exists('shm_attach') || !function_exists('sem_acquire')|| !function_exists('shm_get_var')) {
ZLog::Write(LOGLEVEL_INFO, "IpcSharedMemoryProvider->InitSharedMem(): PHP libraries for the use shared memory are not available. Check the isntalled php packages or use e.g. the memcache IPC provider."); ZLog::Write(LOGLEVEL_INFO, "IpcSharedMemoryProvider->initSharedMem(): PHP libraries for the use shared memory are not available. Check the isntalled php packages or use e.g. the memcache IPC provider.");
return false; return false;
} }
// Create mutex // Create mutex
$this->mutexid = @sem_get($this->type, 1); $this->mutexid = @sem_get($this->type, 1);
if ($this->mutexid === false) { if ($this->mutexid === false) {
ZLog::Write(LOGLEVEL_ERROR, "IpcSharedMemoryProvider->InitSharedMem(): could not aquire semaphore"); ZLog::Write(LOGLEVEL_ERROR, "IpcSharedMemoryProvider->initSharedMem(): could not aquire semaphore");
return false; return false;
} }
// Attach shared memory // Attach shared memory
$this->memid = shm_attach($this->type+10, $this->allocate); $this->memid = shm_attach($this->type+10, $this->allocate);
if ($this->memid === false) { if ($this->memid === false) {
ZLog::Write(LOGLEVEL_ERROR, "IpcSharedMemoryProvider->InitSharedMem(): could not attach shared memory"); ZLog::Write(LOGLEVEL_ERROR, "IpcSharedMemoryProvider->initSharedMem(): could not attach shared memory");
@sem_remove($this->mutexid); @sem_remove($this->mutexid);
$this->mutexid = false; $this->mutexid = false;
return false; return false;
...@@ -97,12 +97,12 @@ class IpcSharedMemoryProvider implements IIpcProvider { ...@@ -97,12 +97,12 @@ class IpcSharedMemoryProvider implements IIpcProvider {
} }
/** /**
* Removes and detaches shared memory * Removes and detaches shared memory.
* *
* @access private * @access private
* @return boolean * @return boolean
*/ */
private function RemoveSharedMem() { private function removeSharedMem() {
if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false)) { if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false)) {
@sem_acquire($this->mutexid); @sem_acquire($this->mutexid);
$memid = $this->memid; $memid = $this->memid;
...@@ -121,17 +121,17 @@ class IpcSharedMemoryProvider implements IIpcProvider { ...@@ -121,17 +121,17 @@ class IpcSharedMemoryProvider implements IIpcProvider {
} }
/** /**
* Reinitializes shared memory by removing, detaching and re-allocating it * Reinitializes the IPC data by removing, detaching and re-allocating it.
* *
* @access public * @access public
* @return boolean * @return boolean
*/ */
public function ReInitSharedMem() { public function ReInitIPC() {
return ($this->RemoveSharedMem() && $this->InitSharedMem()); return ($this->removeSharedMem() && $this->initSharedMem());
} }
/** /**
* Cleans up the shared memory block * Cleans up the IPC data block.
* *
* @access public * @access public
* @return boolean * @return boolean
...@@ -140,12 +140,12 @@ class IpcSharedMemoryProvider implements IIpcProvider { ...@@ -140,12 +140,12 @@ class IpcSharedMemoryProvider implements IIpcProvider {
$stat = false; $stat = false;
// exclusive block // exclusive block
if ($this->blockMutex()) { if ($this->BlockMutex()) {
$cleanuptime = ($this->hasData(1)) ? $this->getData(1) : false; $cleanuptime = ($this->HasData(1)) ? $this->GetData(1) : false;
// TODO implement Shared Memory cleanup // TODO implement Shared Memory cleanup
$this->releaseMutex(); $this->ReleaseMutex();
} }
// end exclusive block // end exclusive block
...@@ -153,7 +153,7 @@ class IpcSharedMemoryProvider implements IIpcProvider { ...@@ -153,7 +153,7 @@ class IpcSharedMemoryProvider implements IIpcProvider {
} }
/** /**
* Indicates if the shared memory is active * Indicates if the IPC is active.
* *
* @access public * @access public
* @return boolean * @return boolean
...@@ -163,14 +163,14 @@ class IpcSharedMemoryProvider implements IIpcProvider { ...@@ -163,14 +163,14 @@ class IpcSharedMemoryProvider implements IIpcProvider {
} }
/** /**
* Blocks the class mutex * Blocks the class mutex.
* Method blocks until mutex is available! * Method blocks until mutex is available!
* ATTENTION: make sure that you *always* release a blocked mutex! * ATTENTION: make sure that you *always* release a blocked mutex!
* *
* @access protected * @access public
* @return boolean * @return boolean
*/ */
public function blockMutex() { public function BlockMutex() {
if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false)) if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false))
return @sem_acquire($this->mutexid); return @sem_acquire($this->mutexid);
...@@ -178,13 +178,13 @@ class IpcSharedMemoryProvider implements IIpcProvider { ...@@ -178,13 +178,13 @@ class IpcSharedMemoryProvider implements IIpcProvider {
} }
/** /**
* Releases the class mutex * Releases the class mutex.
* After the release other processes are able to block the mutex themselfs * After the release other processes are able to block the mutex themselves.
* *
* @access protected * @access public
* @return boolean * @return boolean
*/ */
public function releaseMutex() { public function ReleaseMutex() {
if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false)) if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false))
return @sem_release($this->mutexid); return @sem_release($this->mutexid);
...@@ -192,19 +192,19 @@ class IpcSharedMemoryProvider implements IIpcProvider { ...@@ -192,19 +192,19 @@ class IpcSharedMemoryProvider implements IIpcProvider {
} }
/** /**
* Indicates if the requested variable is available in shared memory * Indicates if the requested variable is available in IPC data.
* *
* @param int $id int indicating the variable * @param int $id int indicating the variable
* *
* @access protected * @access public
* @return boolean * @return boolean
*/ */
public function hasData($id = 2) { public function HasData($id = 2) {
if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false)) { if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false)) {
if (function_exists("shm_has_var")) if (function_exists("shm_has_var"))
return @shm_has_var($this->memid, $id); return @shm_has_var($this->memid, $id);
else { else {
$some = $this->getData($id); $some = $this->GetData($id);
return isset($some); return isset($some);
} }
} }
...@@ -212,14 +212,14 @@ class IpcSharedMemoryProvider implements IIpcProvider { ...@@ -212,14 +212,14 @@ class IpcSharedMemoryProvider implements IIpcProvider {
} }
/** /**
* Returns the requested variable from shared memory * Returns the requested variable from IPC data.
* *
* @param int $id int indicating the variable * @param int $id int indicating the variable
* *
* @access protected * @access public
* @return mixed * @return mixed
*/ */
public function getData($id = 2) { public function GetData($id = 2) {
if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false)) if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false))
return @shm_get_var($this->memid, $id); return @shm_get_var($this->memid, $id);
...@@ -227,16 +227,16 @@ class IpcSharedMemoryProvider implements IIpcProvider { ...@@ -227,16 +227,16 @@ class IpcSharedMemoryProvider implements IIpcProvider {
} }
/** /**
* Writes the transmitted variable to shared memory * Writes the transmitted variable to IPC data.
* Subclasses may never use an id < 2! * Subclasses may never use an id < 2!
* *
* @param mixed $data data which should be saved into shared memory * @param mixed $data data which should be saved into IPC data
* @param int $id int indicating the variable (bigger than 2!) * @param int $id int indicating the variable (bigger than 2!)
* *
* @access protected * @access public
* @return boolean * @return boolean
*/ */
public function setData($data, $id = 2) { public function SetData($data, $id = 2) {
if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false)) if ((isset($this->mutexid) && $this->mutexid !== false) && (isset($this->memid) && $this->memid !== false))
return @shm_put_var($this->memid, $id, $data); return @shm_put_var($this->memid, $id, $data);
...@@ -253,12 +253,12 @@ class IpcSharedMemoryProvider implements IIpcProvider { ...@@ -253,12 +253,12 @@ class IpcSharedMemoryProvider implements IIpcProvider {
$stat = false; $stat = false;
// exclusive block // exclusive block
if ($this->blockMutex()) { if ($this->BlockMutex()) {
if ($this->hasData(1) == false) if ($this->HasData(1) == false)
$stat = $this->setData(time(), 1); $stat = $this->SetData(time(), 1);
$this->releaseMutex(); $this->ReleaseMutex();
} }
// end exclusive block // end exclusive block
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
include_once('backend/ipcsharedmemory/ipcsharedmemoryprovider.php'); include_once('backend/ipcsharedmemory/ipcsharedmemoryprovider.php');
abstract class InterProcessData { abstract class InterProcessData {
// Defines which IPC provider to laod, first has preference // Defines which IPC provider to load, first has preference
// if IPC_PROVIDER in the main config is set, that class will be loaded // if IPC_PROVIDER in the main config is set, that class will be loaded
const PROVIDER_LOAD_ORDER = array('IpcMemcachedProvider', 'IpcSharedMemoryProvider'); const PROVIDER_LOAD_ORDER = array('IpcMemcachedProvider', 'IpcSharedMemoryProvider');
const CLEANUPTIME = 1; const CLEANUPTIME = 1;
...@@ -100,12 +100,12 @@ abstract class InterProcessData { ...@@ -100,12 +100,12 @@ abstract class InterProcessData {
} }
/** /**
* Initializes internal parameters * Initializes internal parameters.
* *
* @access public * @access protected
* @return boolean * @return boolean
*/ */
public function InitializeParams() { protected function initializeParams() {
if (!isset(self::$devid)) { if (!isset(self::$devid)) {
self::$devid = Request::GetDeviceID(); self::$devid = Request::GetDeviceID();
self::$pid = @getmypid(); self::$pid = @getmypid();
...@@ -116,7 +116,17 @@ abstract class InterProcessData { ...@@ -116,7 +116,17 @@ abstract class InterProcessData {
} }
/** /**
* Cleans up the shared memory block * Reinitializes the IPC data by removing, detaching and re-allocating it.
*
* @access public
* @return boolean
*/
public function ReInitIPC() {
return $this->ipcProvider ? $this->ipcProvider->ReInitIPC() : false;
}
/**
* Cleans up the IPC data block.
* *
* @access public * @access public
* @return boolean * @return boolean
...@@ -126,7 +136,7 @@ abstract class InterProcessData { ...@@ -126,7 +136,7 @@ abstract class InterProcessData {
} }
/** /**
* Indicates if the shared memory is active * Indicates if the IPC is active.
* *
* @access public * @access public
* @return boolean * @return boolean
...@@ -136,7 +146,7 @@ abstract class InterProcessData { ...@@ -136,7 +146,7 @@ abstract class InterProcessData {
} }
/** /**
* Blocks the class mutex * Blocks the class mutex.
* Method blocks until mutex is available! * Method blocks until mutex is available!
* ATTENTION: make sure that you *always* release a blocked mutex! * ATTENTION: make sure that you *always* release a blocked mutex!
* *
...@@ -144,22 +154,22 @@ abstract class InterProcessData { ...@@ -144,22 +154,22 @@ abstract class InterProcessData {
* @return boolean * @return boolean
*/ */
protected function blockMutex() { protected function blockMutex() {
return $this->ipcProvider ? $this->ipcProvider->blockMutex() : false; return $this->ipcProvider ? $this->ipcProvider->BlockMutex() : false;
} }
/** /**
* Releases the class mutex * Releases the class mutex.
* After the release other processes are able to block the mutex themselfs * After the release other processes are able to block the mutex themselves.
* *
* @access protected * @access protected
* @return boolean * @return boolean
*/ */
protected function releaseMutex() { protected function releaseMutex() {
return $this->ipcProvider ? $this->ipcProvider->releaseMutex() : false; return $this->ipcProvider ? $this->ipcProvider->ReleaseMutex() : false;
} }
/** /**
* Indicates if the requested variable is available in shared memory * Indicates if the requested variable is available in IPC data.
* *
* @param int $id int indicating the variable * @param int $id int indicating the variable
* *
...@@ -167,11 +177,11 @@ abstract class InterProcessData { ...@@ -167,11 +177,11 @@ abstract class InterProcessData {
* @return boolean * @return boolean
*/ */
protected function hasData($id = 2) { protected function hasData($id = 2) {
return $this->ipcProvider ? $this->ipcProvider->hasData($id) : false; return $this->ipcProvider ? $this->ipcProvider->HasData($id) : false;
} }
/** /**
* Returns the requested variable from shared memory * Returns the requested variable from IPC data.
* *
* @param int $id int indicating the variable * @param int $id int indicating the variable
* *
...@@ -179,20 +189,20 @@ abstract class InterProcessData { ...@@ -179,20 +189,20 @@ abstract class InterProcessData {
* @return mixed * @return mixed
*/ */
protected function getData($id = 2) { protected function getData($id = 2) {
return $this->ipcProvider ? $this->ipcProvider->getData($id) : null; return $this->ipcProvider ? $this->ipcProvider->GetData($id) : null;
} }
/** /**
* Writes the transmitted variable to shared memory * Writes the transmitted variable to IPC data.
* Subclasses may never use an id < 2! * Subclasses may never use an id < 2!
* *
* @param mixed $data data which should be saved into shared memory * @param mixed $data data which should be saved into IPC data
* @param int $id int indicating the variable (bigger than 2!) * @param int $id int indicating the variable (bigger than 2!)
* *
* @access protected * @access protected
* @return boolean * @return boolean
*/ */
protected function setData($data, $id = 2) { protected function setData($data, $id = 2) {
return $this->ipcProvider ? $this->ipcProvider->setData($data, $id) : false; return $this->ipcProvider ? $this->ipcProvider->SetData($data, $id) : false;
} }
} }
...@@ -305,7 +305,7 @@ class LoopDetection extends InterProcessData { ...@@ -305,7 +305,7 @@ class LoopDetection extends InterProcessData {
*/ */
private function updateProcessStack() { private function updateProcessStack() {
// initialize params // initialize params
$this->InitializeParams(); $this->initializeParams();
if ($this->blockMutex()) { if ($this->blockMutex()) {
$loopdata = ($this->hasData()) ? $this->getData() : array(); $loopdata = ($this->hasData()) ? $this->getData() : array();
...@@ -354,7 +354,7 @@ class LoopDetection extends InterProcessData { ...@@ -354,7 +354,7 @@ class LoopDetection extends InterProcessData {
*/ */
private function getProcessStack() { private function getProcessStack() {
// initialize params // initialize params
$this->InitializeParams(); $this->initializeParams();
$stack = array(); $stack = array();
if ($this->blockMutex()) { if ($this->blockMutex()) {
...@@ -401,7 +401,7 @@ class LoopDetection extends InterProcessData { ...@@ -401,7 +401,7 @@ class LoopDetection extends InterProcessData {
$brokenkey = self::BROKENMSGS ."-". $folderid; $brokenkey = self::BROKENMSGS ."-". $folderid;
// initialize params // initialize params
$this->InitializeParams(); $this->initializeParams();
if ($this->blockMutex()) { if ($this->blockMutex()) {
$loopdata = ($this->hasData()) ? $this->getData() : array(); $loopdata = ($this->hasData()) ? $this->getData() : array();
...@@ -443,7 +443,7 @@ class LoopDetection extends InterProcessData { ...@@ -443,7 +443,7 @@ class LoopDetection extends InterProcessData {
$okIds = array(); $okIds = array();
// initialize params // initialize params
$this->InitializeParams(); $this->initializeParams();
if ($this->blockMutex()) { if ($this->blockMutex()) {
$loopdata = ($this->hasData()) ? $this->getData() : array(); $loopdata = ($this->hasData()) ? $this->getData() : array();
...@@ -504,7 +504,7 @@ class LoopDetection extends InterProcessData { ...@@ -504,7 +504,7 @@ class LoopDetection extends InterProcessData {
*/ */
public function SetSyncStateUsage($folderid, $uuid, $counter) { public function SetSyncStateUsage($folderid, $uuid, $counter) {
// initialize params // initialize params
$this->InitializeParams(); $this->initializeParams();
ZLog::Write(LOGLEVEL_DEBUG, sprintf("LoopDetection->SetSyncStateUsage(): uuid: %s counter: %d", $uuid, $counter)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("LoopDetection->SetSyncStateUsage(): uuid: %s counter: %d", $uuid, $counter));
...@@ -551,7 +551,7 @@ class LoopDetection extends InterProcessData { ...@@ -551,7 +551,7 @@ class LoopDetection extends InterProcessData {
*/ */
public function IsSyncStateObsolete($folderid, $uuid, $counter) { public function IsSyncStateObsolete($folderid, $uuid, $counter) {
// initialize params // initialize params
$this->InitializeParams(); $this->initializeParams();
$obsolete = false; $obsolete = false;
...@@ -636,7 +636,7 @@ class LoopDetection extends InterProcessData { ...@@ -636,7 +636,7 @@ class LoopDetection extends InterProcessData {
} }
// initialize params // initialize params
$this->InitializeParams(); $this->initializeParams();
$loop = false; $loop = false;
......
...@@ -89,7 +89,7 @@ class PingTracking extends InterProcessData { ...@@ -89,7 +89,7 @@ class PingTracking extends InterProcessData {
$stat = false; $stat = false;
// initialize params // initialize params
$this->InitializeParams(); $this->initializeParams();
// exclusive block // exclusive block
if ($this->blockMutex()) { if ($this->blockMutex()) {
......
...@@ -63,7 +63,7 @@ class TopCollector extends InterProcessData { ...@@ -63,7 +63,7 @@ class TopCollector extends InterProcessData {
parent::__construct(); parent::__construct();
// initialize params // initialize params
$this->InitializeParams(); $this->initializeParams();
$this->preserved = array(); $this->preserved = array();
// static vars come from the parent class // static vars come from the parent class
...@@ -222,8 +222,9 @@ class TopCollector extends InterProcessData { ...@@ -222,8 +222,9 @@ class TopCollector extends InterProcessData {
} }
} }
} }
foreach ($toClear as $tc) foreach ($toClear as $tc) {
unset($topdata[$tc[0]][$tc[1]][$tc[2]]); unset($topdata[$tc[0]][$tc[1]][$tc[2]]);
}
} }
$stat = $this->setData($topdata, self::TOPDATA); $stat = $this->setData($topdata, self::TOPDATA);
...@@ -260,6 +261,20 @@ class TopCollector extends InterProcessData { ...@@ -260,6 +261,20 @@ class TopCollector extends InterProcessData {
return true; return true;
} }
/**
* Reinitializes the IPC data.
*
* @access public
* @return boolean
*/
public function ReInitIPC() {
$status = parent::ReInitIPC();
if (!status) {
$this->SetData(array(), self::TOPDATA);
}
return $status;
}
/** /**
* Indicates if top data should be saved or not * Indicates if top data should be saved or not
* Returns true for 10 seconds after the latest CollectData() * Returns true for 10 seconds after the latest CollectData()
......
...@@ -74,7 +74,7 @@ class SimpleMutex extends InterProcessData { ...@@ -74,7 +74,7 @@ class SimpleMutex extends InterProcessData {
/** /**
* Releases the mutex * Releases the mutex
* After the release other processes are able to block the mutex themselfs * After the release other processes are able to block the mutex themselves
* *
* @access public * @access public
* @return boolean * @return boolean
......
...@@ -54,7 +54,16 @@ interface IIpcProvider ...@@ -54,7 +54,16 @@ interface IIpcProvider
public function __construct($type, $allocate, $class); public function __construct($type, $allocate, $class);
/** /**
* Cleans up the shared memory block * Reinitializes the IPC data. If the provider has no way of performing
* this action, it should return 'false'.
*
* @access public
* @return boolean
*/
public function ReInitIPC();
/**
* Cleans up the IPC data block.
* *
* @access public * @access public
* @return boolean * @return boolean
...@@ -62,7 +71,7 @@ interface IIpcProvider ...@@ -62,7 +71,7 @@ interface IIpcProvider
public function Clean(); public function Clean();
/** /**
* Indicates if the shared memory is active * Indicates if the IPC is active.
* *
* @access public * @access public
* @return boolean * @return boolean
...@@ -70,53 +79,53 @@ interface IIpcProvider ...@@ -70,53 +79,53 @@ interface IIpcProvider
public function IsActive(); public function IsActive();
/** /**
* Blocks the class mutex * Blocks the class mutex.
* Method blocks until mutex is available! * Method blocks until mutex is available!
* ATTENTION: make sure that you *always* release a blocked mutex! * ATTENTION: make sure that you *always* release a blocked mutex!
* *
* @access protected * @access public
* @return boolean * @return boolean
*/ */
public function blockMutex(); public function BlockMutex();
/** /**
* Releases the class mutex * Releases the class mutex.
* After the release other processes are able to block the mutex themselfs * After the release other processes are able to block the mutex themselves.
* *
* @access protected * @access public
* @return boolean * @return boolean
*/ */
public function releaseMutex(); public function ReleaseMutex();
/** /**
* Indicates if the requested variable is available in shared memory * Indicates if the requested variable is available in IPC data.
* *
* @param int $id int indicating the variable * @param int $id int indicating the variable
* *
* @access protected * @access public
* @return boolean * @return boolean
*/ */
public function hasData($id = 2); public function HasData($id = 2);
/** /**
* Returns the requested variable from shared memory * Returns the requested variable from IPC data.
* *
* @param int $id int indicating the variable * @param int $id int indicating the variable
* *
* @access protected * @access public
* @return mixed * @return mixed
*/ */
public function getData($id = 2); public function GetData($id = 2);
/** /**
* Writes the transmitted variable to shared memory * Writes the transmitted variable to IPC data.
* Subclasses may never use an id < 2! * Subclasses may never use an id < 2!
* *
* @param mixed $data data which should be saved into shared memory * @param mixed $data data which should be saved into IPC data
* @param int $id int indicating the variable (bigger than 2!) * @param int $id int indicating the variable (bigger than 2!)
* *
* @access protected * @access public
* @return boolean * @return boolean
*/ */
public function setData($data, $id = 2); public function SetData($data, $id = 2);
} }
...@@ -480,7 +480,7 @@ class ZPushTop { ...@@ -480,7 +480,7 @@ class ZPushTop {
else if ($cmds[0] == "clear" ) { else if ($cmds[0] == "clear" ) {
$this->topCollector->ClearLatest(true); $this->topCollector->ClearLatest(true);
$this->topCollector->CollectData(true); $this->topCollector->CollectData(true);
$this->topCollector->ReInitSharedMem(); $this->topCollector->ReInitIPC();
} }
else if ($cmds[0] == "filter" || $cmds[0] == "f") { else if ($cmds[0] == "filter" || $cmds[0] == "f") {
if (!isset($cmds[1]) || $cmds[1] == "") { if (!isset($cmds[1]) || $cmds[1] == "") {
......
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