git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Vlasov <vsu@altlinux.ru>
To: Junio C Hamano <junkio@cox.net>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: [RFC] multi_ack protocol v2
Date: Thu, 27 Oct 2005 14:16:19 +0400	[thread overview]
Message-ID: <20051027141619.0e8029f2.vsu@altlinux.ru> (raw)
In-Reply-To: <7vzmov4elu.fsf@assigned-by-dhcp.cox.net>

[-- Attachment #1: Type: text/plain, Size: 2780 bytes --]

On Thu, 27 Oct 2005 00:13:17 -0700 Junio C Hamano wrote:

[skip]
> So let's illustrate the v2 the same way as I understand it.
> 
> upload-pack (S) | fetch/clone-pack (C) protocol (v2):
> 
> 	# Tell the puller what commits we have and what their names are
> 	S: SHA1 name
> 	S: ...
> 	S: SHA1 name
> 	S: # flush -- it's your turn
> 	# Tell the pusher what commits we want, and what we have.
>         # In addition, we tell the other end that we support protocol
> 	# extensions, without breaking the old servers.
> 	C: want SHA1 extended
> 	C: ..
> 	C: want SHA1
> 	C: # flush -- done with "want" lines.
> 
> Notice that until we hear from the server, we cannot tell if our
> "extended" protocol wish will be granted, and in the original
> protocol, "NAK" will come in fixed length, and the only thing we
> could tack arbitrary garbage to was "ACK SHA1".  That's why your
> "ACK SHA1 continue" works nicely, but at the time you could not
> find out if you are talking with updated server until you get at
> least one ACK.

Actually, there is another way to pass some data from the server
which would be ignored by older clients - at the first stage,
when upload-pack sends the list of refs to the client:

	packet_write(1, "%s %s%c%s\n", sha1_to_hex(sha1), refname, '\0',
		     server_capabilities);

Old clients will ignore the additional data (functions which
work with the received name will happily stop at the added NUL
character; just some memory will be wasted), but the new
implementation of get_remote_heads() could look for that NUL
inside the received packet and find extended server capabilities
after it.  Then the client could just use new commands at the
"want" stage.

> However, at this point, we *could* force the server to reveal
> what it supports, by doing an extra flush here, before sending
> *ANY* "have" lines yet:
> 
> 	C: # flush -- this is another one after "I'm done with wants".
> 
> Upon receiving this, if we were talking with an old upload-pack,
> we would certanly get an NAK.  Note that the server already
> knows that we support extended protocol at this point, so our
> updated server can send anything here to say it knows what
> protocol extensions it supports.  Let's say it says something
> like this:
> 
> 	S: proto v2 v3 v5
> 
> to tell the puller it understands protocol v2, v3, and v5, to
> which the puller responds:
> 
> 	C: proto v2
> 
> After this exchange, both ends know they understand and would
> want to talk at protocol level v2.  This leaves door open for
> future protocol extension, but more importantly, I think this
> arrangement would make things safer.

This looks cleaner (no NUL bytes in the protocol), but does not
allow to replace the "want" stage with something entirely
different (if we ever want to do that).

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2005-10-27 10:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-27  0:16 [RFC] multi_ack protocol v2 Johannes Schindelin
2005-10-27  7:13 ` Junio C Hamano
2005-10-27  9:37   ` Johannes Schindelin
2005-10-27 10:16   ` Sergey Vlasov [this message]
2005-10-27 10:47     ` Johannes Schindelin
2005-10-27 17:45       ` Junio C Hamano
2005-10-27 18:04         ` Johannes Schindelin
2005-10-27 19:15           ` Junio C Hamano
2005-10-27  9:11 ` Paul Mackerras
2005-10-27 10:54   ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051027141619.0e8029f2.vsu@altlinux.ru \
    --to=vsu@altlinux.ru \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).