diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-05-28 13:54:32 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-05-28 13:54:32 +0000 |
| commit | cb891c6f96ffc8b0d7c8a6ff83574f43818fe092 (patch) | |
| tree | a81dbd15cb2f22327eef34d009eb15ad2675712a /roundcubemail/program/include/rcube_imap_generic.php | |
| parent | 43dea739f1d9c49dcdd6d59c20d1f3a10263ee91 (diff) | |
- Add 'imap_timeout' option (#1486760)
git-svn-id: https://svn.roundcube.net/trunk@3684 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_imap_generic.php')
| -rw-r--r-- | roundcubemail/program/include/rcube_imap_generic.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/roundcubemail/program/include/rcube_imap_generic.php b/roundcubemail/program/include/rcube_imap_generic.php index d159b903c..7796e0a11 100644 --- a/roundcubemail/program/include/rcube_imap_generic.php +++ b/roundcubemail/program/include/rcube_imap_generic.php @@ -611,14 +611,21 @@ class rcube_imap_generic $host = $this->prefs['ssl_mode'] . '://' . $host; } - $this->fp = @fsockopen($host, $this->prefs['port'], $errno, $errstr, 10); + // Connect + if ($this->prefs['timeout'] > 0) + $this->fp = @fsockopen($host, $this->prefs['port'], $errno, $errstr, $this->prefs['timeout']); + else + $this->fp = @fsockopen($host, $this->prefs['port'], $errno, $errstr); + if (!$this->fp) { $this->error = sprintf("Could not connect to %s:%d: %s", $host, $this->prefs['port'], $errstr); $this->errornum = -2; return false; } - stream_set_timeout($this->fp, 10); + if ($this->prefs['timeout'] > 0) + stream_set_timeout($this->fp, $this->prefs['timeout']); + $line = trim(fgets($this->fp, 8192)); if ($this->prefs['debug_mode'] && $line) { |
