ReceivePack: enable capabilities immediately on first line

Instead of deferring until after command parsing, enable the
capabilities after the first pkt-line has been read from the client.
This allows the server to setup the side-band-64k channel immediately.

Change-Id: I141b7fc92e983a41d3a58da8e1464a6917422b6c
This commit is contained in:
Shawn Pearce 2016-07-05 12:37:26 -07:00
parent 60ca93798c
commit 306932c701
2 changed files with 5 additions and 5 deletions

View File

@ -1077,7 +1077,7 @@ public void sendAdvertisedRefs(final RefAdvertiser adv)
*/
protected void recvCommands() throws IOException {
PushCertificateParser certParser = getPushCertificateParser();
FirstLine firstLine = null;
boolean firstPkt = true;
try {
for (;;) {
String line;
@ -1097,10 +1097,12 @@ protected void recvCommands() throws IOException {
continue;
}
if (firstLine == null) {
firstLine = new FirstLine(line);
if (firstPkt) {
firstPkt = false;
FirstLine firstLine = new FirstLine(line);
enabledCapabilities = firstLine.getCapabilities();
line = firstLine.getLine();
enableCapabilities();
if (line.equals(GitProtocolConstants.OPTION_PUSH_CERT)) {
certParser.receiveHeader(pckIn, !isBiDirectionalPipe());

View File

@ -184,8 +184,6 @@ private void service() throws IOException {
return;
recvCommands();
if (hasCommands()) {
enableCapabilities();
Throwable unpackError = null;
if (needPack()) {
try {