Skip to content

Commit 2c5589c

Browse files
committed
Update clue/redis-protocol to v0.3.0
1 parent 3aedc6f commit 2c5589c

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"react/promise": "~1",
1515
"react/socket-client": "0.3.*",
1616
"react/event-loop": "0.3.*",
17-
"clue/redis-protocol": "0.2.*"
17+
"clue/redis-protocol": "0.3.*"
1818
},
1919
"autoload": {
2020
"psr-0": { "Clue\\Redis\\React": "src" }

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Clue/Redis/React/Client.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct(Stream $stream, ParserInterface $parser = null, Seri
2727
if ($parser === null || $serializer === null) {
2828
$factory = new ProtocolFactory();
2929
if ($parser === null) {
30-
$parser = $factory->createParser();
30+
$parser = $factory->createResponseParser();
3131
}
3232
if ($serializer === null) {
3333
$serializer = $factory->createSerializer();
@@ -37,17 +37,15 @@ public function __construct(Stream $stream, ParserInterface $parser = null, Seri
3737
$that = $this;
3838
$stream->on('data', function($chunk) use ($parser, $that) {
3939
try {
40-
$parser->pushIncoming($chunk);
40+
$models = $parser->pushIncoming($chunk);
4141
}
4242
catch (ParserException $error) {
4343
$that->emit('error', array($error));
4444
$that->close();
4545
return;
4646
}
4747

48-
while ($parser->hasIncomingModel()) {
49-
$data = $parser->popIncomingModel();
50-
48+
foreach ($models as $data) {
5149
try {
5250
$that->handleReply($data);
5351
}
@@ -74,12 +72,7 @@ public function __call($name, $args)
7472
return When::reject(new RuntimeException('Connection closed'));
7573
}
7674

77-
$name = strtoupper($name);
78-
79-
/* Build the Redis unified protocol command */
80-
array_unshift($args, $name);
81-
82-
$this->stream->write($this->serializer->createRequestMessage($args));
75+
$this->stream->write($this->serializer->getRequestMessage($name, $args));
8376

8477
$request = new Request($name);
8578
$this->requests []= $request;

src/Clue/Redis/React/Factory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function createClient($target = null)
4141
$protocol = $this->protocol;
4242

4343
return $this->connect($target)->then(function (Stream $stream) use ($auth, $db, $protocol) {
44-
$client = new Client($stream, $protocol->createParser(), $protocol->createSerializer());
44+
$client = new Client($stream, $protocol->createResponseParser(), $protocol->createSerializer());
4545

4646
return When::all(
4747
array(

0 commit comments

Comments
 (0)