Changeset View
Changeset View
Standalone View
Standalone View
src/include/rcube_imap_generic.php
Show First 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | protected function readLine($size = 1024) | ||||
do { | do { | ||||
if ($this->eof()) { | if ($this->eof()) { | ||||
return $line ?: null; | return $line ?: null; | ||||
} | } | ||||
$buffer = fgets($this->fp, $size); | $buffer = fgets($this->fp, $size); | ||||
if ($buffer === false) { | if ($buffer === false) { | ||||
$this->debug("Reading from server failed, closing socket."); | |||||
$this->closeSocket(); | $this->closeSocket(); | ||||
break; | break; | ||||
} | } | ||||
if ($this->debug) { | if ($this->debug) { | ||||
$this->debug('S: '. rtrim($buffer)); | $this->debug('S: '. rtrim($buffer)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,828 Lines • ▼ Show 20 Lines | public function append($mailbox, &$message, $flags = array(), $date = null, $binary = false) | ||||
else { | else { | ||||
$size = strlen($msg_part); | $size = strlen($msg_part); | ||||
// Break up the data by sending one chunk (up to 512k) at a time. | // Break up the data by sending one chunk (up to 512k) at a time. | ||||
// This approach reduces our peak memory usage | // This approach reduces our peak memory usage | ||||
for ($offset = 0; $offset < $size; $offset += $chunk_size) { | for ($offset = 0; $offset < $size; $offset += $chunk_size) { | ||||
$chunk = substr($msg_part, $offset, $chunk_size); | $chunk = substr($msg_part, $offset, $chunk_size); | ||||
if (!$this->putLine($chunk, false)) { | if (!$this->putLine($chunk, false)) { | ||||
$this->setError(self::ERROR_UNKNOWN, "putLine failed on chunk"); | |||||
machniak: The message should be more explanatory, maybe "Failed to write to socket on APPEND". | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (!$this->putLine('')) { // \r\n | if (!$this->putLine('')) { // \r\n | ||||
$this->setError(self::ERROR_UNKNOWN, "putLine '' failed"); | |||||
machniakUnsubmitted Not Done Inline ActionsSame here. machniak: Same here. | |||||
return false; | return false; | ||||
} | } | ||||
do { | do { | ||||
$line = $this->readLine(); | $line = $this->readLine(); | ||||
} while (!$this->startsWith($line, $key, true, true)); | } while (!$this->startsWith($line, $key, true, true)); | ||||
// Clear internal status cache | // Clear internal status cache | ||||
▲ Show 20 Lines • Show All 1,040 Lines • Show Last 20 Lines |
The message should be more explanatory, maybe "Failed to write to socket on APPEND".