1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00

Fix a property name collision in ArcanistHgServerChannel

Summary:
See D2665. Here, `channel` is the Mercurial wire protocol channel name ("o" = "output", "e" = "error", etc), not the underlying channel from `PhutilProxyChannel`.

Rename the property so there's no collision.

Test Plan:
```
$ ../../core/lib/arcanist/scripts/hgdaemon/hgdaemon_client.php . --trace --skip-hello
array(3) {
  [0]=>
  int(0)
  [1]=>
  string(103) "capabilities: getencoding runcommand
encoding: UTF-8
pid: 73263e20cf21273d50f1f66cab6e0f7c74f4864e67f0f"
  [2]=>
  string(0) ""
}

Executed in 30647 us.
```

Reviewers: vrana, chad

Reviewed By: vrana

Differential Revision: https://secure.phabricator.com/D17366
This commit is contained in:
epriestley 2017-02-16 05:08:51 -08:00
parent 13596cd10f
commit 460b0e46ee

View file

@ -54,6 +54,7 @@ final class ArcanistHgServerChannel extends PhutilProtocolChannel {
private $mode = self::MODE_CHANNEL; private $mode = self::MODE_CHANNEL;
private $byteLengthOfNextChunk = 1; private $byteLengthOfNextChunk = 1;
private $buf = ''; private $buf = '';
private $outputChannel;
/* -( Protocol Implementation )-------------------------------------------- */ /* -( Protocol Implementation )-------------------------------------------- */
@ -137,7 +138,7 @@ final class ArcanistHgServerChannel extends PhutilProtocolChannel {
// 'output', 'error', 'result' or 'debug' respectively. This is a // 'output', 'error', 'result' or 'debug' respectively. This is a
// single byte long. Next, we'll expect a length. // single byte long. Next, we'll expect a length.
$this->channel = $chunk; $this->outputChannel = $chunk;
$this->byteLengthOfNextChunk = 4; $this->byteLengthOfNextChunk = 4;
$this->mode = self::MODE_LENGTH; $this->mode = self::MODE_LENGTH;
break; break;
@ -153,11 +154,11 @@ final class ArcanistHgServerChannel extends PhutilProtocolChannel {
// given length. We produce a message from the channel and the data // given length. We produce a message from the channel and the data
// and return it. Next, we expect another channel name. // and return it. Next, we expect another channel name.
$message = array($this->channel, $chunk); $message = array($this->outputChannel, $chunk);
$this->byteLengthOfNextChunk = 1; $this->byteLengthOfNextChunk = 1;
$this->mode = self::MODE_CHANNEL; $this->mode = self::MODE_CHANNEL;
$this->channel = null; $this->outputChannel = null;
$messages[] = $message; $messages[] = $message;
break; break;