Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13989791
D18859.id45239.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D18859.id45239.diff
View Options
diff --git a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php
--- a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php
+++ b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php
@@ -180,6 +180,15 @@
$this->state = 'arguments';
}
} else if ($this->state == 'data-length') {
+
+ // We're reading the length of a chunk of raw data. It looks like
+ // this:
+ //
+ // <length-in-bytes>\n
+ //
+ // The length is human-readable text (for example, "4096"), and
+ // may be 0.
+
$line = $this->readProtocolLine();
if ($line === null) {
break;
@@ -192,6 +201,9 @@
$this->state = 'data-bytes';
}
} else if ($this->state == 'data-bytes') {
+
+ // We're reading some known, nonzero number of raw bytes of data.
+
// If we don't have any more bytes on the buffer yet, just bail:
// otherwise, we'll emit a pointless and possibly harmful 0-byte data
// frame. See T13036 for discussion.
@@ -203,6 +215,13 @@
$this->buffer = substr($this->buffer, strlen($bytes));
$this->expectBytes -= strlen($bytes);
+ // NOTE: We emit a data frame as soon as we read some data. This can
+ // cause us to repackage frames: for example, if we receive one large
+ // frame slowly, we may emit it as several smaller frames. In theory
+ // this is good; in practice, Mercurial never seems to select a frame
+ // size larger than 4096 bytes naturally and this may be more
+ // complexity and trouble than it is worth. See T13036.
+
$messages[] = $this->newDataMessage($bytes);
if (!$this->expectBytes) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 22, 11:07 PM (4 w, 17 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6711725
Default Alt Text
D18859.id45239.diff (1 KB)
Attached To
Mode
D18859: Add a couple of clarifying comments to the Mercurial protocol parser
Attached
Detach File
Event Timeline
Log In to Comment