mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
Added: Configurable timeouts for IMAP, SMTP and SIEVE (#843)
This commit is contained in:
parent
c6f098bd2d
commit
55e3bad890
7 changed files with 17 additions and 3 deletions
|
|
@ -76,6 +76,11 @@ class Config
|
|||
*/
|
||||
public static $BoundaryPrefix = '_Part_';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public static $ImapTimeout = 300;
|
||||
|
||||
/**
|
||||
* @var \MailSo\Log\Logger|null
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class MailClient
|
|||
$this->oLogger = null;
|
||||
|
||||
$this->oImapClient = \MailSo\Imap\ImapClient::NewInstance();
|
||||
$this->oImapClient->SetTimeOuts(10, 300); // TODO
|
||||
$this->oImapClient->SetTimeOuts(10, \MailSo\Config::$ImapTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -165,8 +165,8 @@ abstract class NetClient
|
|||
*/
|
||||
public function SetTimeOuts($iConnectTimeOut = 10, $iSocketTimeOut = 10)
|
||||
{
|
||||
$this->iConnectTimeOut = $iConnectTimeOut;
|
||||
$this->iSocketTimeOut = $iSocketTimeOut;
|
||||
$this->iConnectTimeOut = 5 < $iConnectTimeOut ? $iConnectTimeOut : 5;
|
||||
$this->iSocketTimeOut = 5 < $iSocketTimeOut ? $iSocketTimeOut : 5;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6102,6 +6102,7 @@ class Actions
|
|||
$bUsePhpMail = $oAccount->Domain()->OutUsePhpMail();
|
||||
|
||||
$oSmtpClient = \MailSo\Smtp\SmtpClient::NewInstance()->SetLogger($this->Logger());
|
||||
$oSmtpClient->SetTimeOuts(10, (int) \RainLoop\Api::Config()->Get('labs', 'smtp_timeout', 60));
|
||||
|
||||
$bLoggined = $oAccount->OutConnectAndLoginHelper($this->Plugins(), $oSmtpClient, $this->Config(), $bUsePhpMail);
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,9 @@ class Api
|
|||
\MailSo\Config::$LargeThreadLimit =
|
||||
(int) \RainLoop\Api::Config()->Get('labs', 'imap_large_thread_limit', 50);
|
||||
|
||||
\MailSo\Config::$ImapTimeout =
|
||||
(int) \RainLoop\Api::Config()->Get('labs', 'imap_timeout', 300);
|
||||
|
||||
\MailSo\Config::$BoundaryPrefix = '_RainLoop_';
|
||||
|
||||
\MailSo\Config::$SystemLogger = \RainLoop\Api::Logger();
|
||||
|
|
|
|||
|
|
@ -330,6 +330,9 @@ Enables caching in the system'),
|
|||
'smtp_show_server_errors' => array(false),
|
||||
'sieve_allow_raw_script' => array(false),
|
||||
'sieve_utf8_folder_name' => array(true),
|
||||
'imap_timeout' => array(300),
|
||||
'smtp_timeout' => array(60),
|
||||
'sieve_timeout' => array(10),
|
||||
'mail_func_clear_headers' => array(true),
|
||||
'mail_func_additional_parameters' => array(false),
|
||||
'favicon_status' => array(true),
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
|
|||
$aFilters = array();
|
||||
|
||||
$oSieveClient = \MailSo\Sieve\ManageSieveClient::NewInstance()->SetLogger($this->oLogger);
|
||||
$oSieveClient->SetTimeOuts(10, (int) \RainLoop\Api::Config()->Get('labs', 'sieve_timeout', 10));
|
||||
|
||||
if ($oAccount->SieveConnectAndLoginHelper($this->oPlugins, $oSieveClient, $this->oConfig))
|
||||
{
|
||||
|
|
@ -114,6 +115,7 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
|
|||
public function Save($oAccount, $aFilters, $sRaw = '', $bRawIsActive = false)
|
||||
{
|
||||
$oSieveClient = \MailSo\Sieve\ManageSieveClient::NewInstance()->SetLogger($this->oLogger);
|
||||
$oSieveClient->SetTimeOuts(10, (int) \RainLoop\Api::Config()->Get('labs', 'sieve_timeout', 10));
|
||||
|
||||
if ($oAccount->SieveConnectAndLoginHelper($this->oPlugins, $oSieveClient, $this->oConfig))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue