mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
Fix some performance issues
This commit is contained in:
parent
5b465f5337
commit
40a0f8b821
5 changed files with 56 additions and 8 deletions
|
|
@ -2272,6 +2272,8 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
$this->writeLog('Start Callback for '.$sParent.' / '.$sLiteralAtomUpperCase.
|
||||
' - try to read '.$iLiteralLen.' bytes.', \MailSo\Log\Enumerations\Type::NOTE);
|
||||
|
||||
$this->bRunningCallback = true;
|
||||
|
||||
try
|
||||
{
|
||||
\call_user_func($this->aFetchCallbacks[$sFetchKey],
|
||||
|
|
@ -2330,6 +2332,8 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
}
|
||||
|
||||
\MailSo\Base\Loader::IncStatistic('NetRead', $iLiteralLen);
|
||||
|
||||
$this->bRunningCallback = false;
|
||||
}
|
||||
|
||||
return $bResult;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ abstract class NetClient
|
|||
*/
|
||||
protected $bUnreadBuffer;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $bRunningCallback;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
|
@ -63,6 +68,11 @@ abstract class NetClient
|
|||
*/
|
||||
protected $oLogger;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $__AUTOLOGOUT__;
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
*/
|
||||
|
|
@ -70,7 +80,10 @@ abstract class NetClient
|
|||
{
|
||||
$this->rConnect = null;
|
||||
$this->bUnreadBuffer = false;
|
||||
$this->bRunningCallback = false;
|
||||
$this->oLogger = null;
|
||||
|
||||
$this->__AUTOLOGOUT__ = true;
|
||||
|
||||
$this->sResponseBuffer = '';
|
||||
|
||||
|
|
@ -93,7 +106,14 @@ abstract class NetClient
|
|||
{
|
||||
try
|
||||
{
|
||||
$this->LogoutAndDisconnect();
|
||||
if ($this->__AUTOLOGOUT__)
|
||||
{
|
||||
$this->LogoutAndDisconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->Disconnect();
|
||||
}
|
||||
}
|
||||
catch (\Exception $oException) {}
|
||||
}
|
||||
|
|
@ -257,7 +277,7 @@ abstract class NetClient
|
|||
*/
|
||||
public function LogoutAndDisconnect()
|
||||
{
|
||||
if (\method_exists($this, 'Logout') && !$this->bUnreadBuffer)
|
||||
if (\method_exists($this, 'Logout') && !$this->bUnreadBuffer && !$this->bRunningCallback)
|
||||
{
|
||||
$this->Logout();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,6 +407,8 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
|
||||
$this->writeLog('Message data.', \MailSo\Log\Enumerations\Type::NOTE);
|
||||
|
||||
$this->bRunningCallback = true;
|
||||
|
||||
while (!\feof($rDataStream))
|
||||
{
|
||||
$sBuffer = \fgets($rDataStream);
|
||||
|
|
@ -434,6 +436,8 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
|
||||
$this->sendRequestWithCheck('.', 250);
|
||||
|
||||
$this->bRunningCallback = false;
|
||||
|
||||
$this->bData = true;
|
||||
|
||||
return $this;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue