mirror of
https://github.com/predis/predis.git
synced 2026-08-30 12:15:03 +00:00
More reliable network writes in Predis\Protocols\TextProtocol.
This commit is contained in:
+11
-1
@@ -1581,7 +1581,17 @@ class TextProtocol implements IRedisProtocol {
|
||||
$buffer .= "\${$arglen}\r\n{$argument}\r\n";
|
||||
}
|
||||
|
||||
fwrite($connection->getResource(), $buffer);
|
||||
$socket = $connection->getResource();
|
||||
while (($length = strlen($buffer)) > 0) {
|
||||
$written = fwrite($socket, $buffer);
|
||||
if ($length === $written) {
|
||||
return;
|
||||
}
|
||||
if ($written === false || $written === 0) {
|
||||
$this->onCommunicationException('Error while writing bytes to the server');
|
||||
}
|
||||
$value = substr($buffer, $written);
|
||||
}
|
||||
}
|
||||
|
||||
public function read(IConnectionSingle $connection) {
|
||||
|
||||
Reference in New Issue
Block a user