From fa216abd95c69c314800ff4cd8981642374439c7 Mon Sep 17 00:00:00 2001 From: Jaime Baez Date: Tue, 9 Jun 2015 09:53:48 +0100 Subject: [PATCH] Fix ApnsPHP_Push to not send a pcnt_signal_dispatch if is not in serverMode. --- ApnsPHP/Push.php | 4 +++- ApnsPHP/Push/Server.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ApnsPHP/Push.php b/ApnsPHP/Push.php index 6bf50543..38871677 100644 --- a/ApnsPHP/Push.php +++ b/ApnsPHP/Push.php @@ -39,6 +39,8 @@ class ApnsPHP_Push extends ApnsPHP_Abstract const STATUS_CODE_INTERNAL_ERROR = 999; /**< @type integer Status code for internal error (not Apple). */ + protected $_bServerMode = false; /** @type boolean Server mode sends a pcntl_signal_dispatch on send method. Used by ApnsPHP_Push_Server */ + protected $_aErrorResponseMessages = array( 0 => 'No errors encountered', 1 => 'Processing error', @@ -138,7 +140,7 @@ public function send() $bError = false; foreach($this->_aMessageQueue as $k => &$aMessage) { - if (function_exists('pcntl_signal_dispatch')) { + if ($this->_bServerMode && function_exists('pcntl_signal_dispatch')) { pcntl_signal_dispatch(); } diff --git a/ApnsPHP/Push/Server.php b/ApnsPHP/Push/Server.php index bb120755..8be922aa 100644 --- a/ApnsPHP/Push/Server.php +++ b/ApnsPHP/Push/Server.php @@ -60,6 +60,7 @@ public function __construct($nEnvironment, $sProviderCertificateFile) { parent::__construct($nEnvironment, $sProviderCertificateFile); + $this->_bServerMode = true; $this->_nParentPid = posix_getpid(); $this->_hShm = shm_attach(mt_rand(), self::SHM_SIZE); if ($this->_hShm === false) {