Skip to content

修复_multi_bulk_reply方法在获取多个空值的情况下超时问题。 #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions libraries/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ private function _bulk_reply()
}

}

// Remove the new line and carriage return before reading another bulk reply
fgets($this->_connection);
// Clear the socket in case anything remains in there
$this->_clear_socket();

Expand All @@ -392,17 +393,16 @@ private function _multi_bulk_reply()
// Loop all values and add them to the response array
for ($i = 0; $i < $total_values; $i++)
{
// Remove the new line and carriage return before reading
// another bulk reply
// Remove the '$' flags
fgets($this->_connection, 2);

// If this is a second or later pass, we also need to get rid
// of the $ indicating a new bulk reply and its length.
if ($i > 0)
{
fgets($this->_connection);
fgets($this->_connection, 2);
}
// if ($i > 0)
// {
// fgets($this->_connection);
// fgets($this->_connection, 2);
// }

$response[] = $this->_bulk_reply();

Expand Down