git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH v3 5/8] Support taking over transports

From
ILIlari Liusvaara <ilari.liusvaara@elisanet.fi>
Date
Dec 7, 2009, 21:19 UTC
Message-ID
<20091207211907.GA3916@Knoppix>
In-Reply-To
<20091207174947.GF17173@spearce.org>
On Mon, Dec 07, 2009 at 09:49:47AM -0800, Shawn O. Pearce wrote:
Show 10 quoted lines
> 
> > +	if (duped < 0)
> > +		die_errno("Can't dup helper output fd");
> > +	data->out = xfdopen(duped, "r");
> > +	setvbuf(data->out, NULL, _IONBF, 0);
> 
> I wonder if this is really a good idea.  Most helpers actually
> use a lot of text based IO to communicate.  Disabling buffering
> for those helpers to avoid overreading the advertisement from a
> connect is a problem.
I dropped the buffering change. 
 
Show 10 quoted lines
> Maybe we could leave buffering on, but use a handshake protocol
> with the helper during connect:
> 
>   (1) > "connect git-upload-pack\n"
>   (2) < "\n"
>   (3) > "begin\n"
> 
> During 2 we are still buffered, but the only content on the pipe
> should be the single blank line, so we pull that in and the FILE*
> buffer should be empty.
Doesn't work. Stream buffering can only be changed before first
I/O.
 
I figured out a solution. Dup the file descriptor second time and
make another FILE* for it. Then send the connect and read the
response over the new stream. This avoids overreading and allows
other I/O to be buffered. After connect attempt, the new streaam
can be closed.

This way most of the I/O can be buffered, only reading responses to connect commands can't, and that is at most 1 byte if fallbacks aren't required. And the thing fits nicely inside _process_connect(). Oh, and no protocol change needed.

-Ilari
Previous: Shawn O. PearceNext: Ilari Liusvaara
Message 8 of 25 in “Remote helpers smart transport extensions”
  1. 0/8 Remote helpers smart transport extensionsIlari Liusvaara, Dec 6, 2009
  2. 1/8 Add remote helper debug modeIlari Liusvaara, Dec 6, 2009
  3. 2/8 Support mandatory capabilitiesIlari Liusvaara, Dec 6, 2009
  4. 3/8 Pass unknown protocols to external protocol handlersIlari Liusvaara, Dec 6, 2009
  5. 4/8 Refactor git transport options parsingIlari Liusvaara, Dec 6, 2009
  6. 5/8 Support taking over transportsIlari Liusvaara, Dec 6, 2009
  7. Shawn O. PearceDec 7, 2009
  8. Ilari LiusvaaraDec 7, 2009
  9. 6/8 Support remote helpers implementing smart transportsIlari Liusvaara, Dec 6, 2009
  10. Shawn O. PearceDec 7, 2009
  11. Ilari LiusvaaraDec 7, 2009
  12. 7/8 Support remote archive from external protocol helpersIlari Liusvaara, Dec 6, 2009
  13. Shawn O. PearceDec 7, 2009
  14. Ilari LiusvaaraDec 7, 2009
  15. 8/8 Remove special casing of http, https and ftpIlari Liusvaara, Dec 6, 2009
  16. Junio C HamanoDec 7, 2009
  17. Nanako ShiraishiDec 7, 2009
  18. Erik Faye-LundDec 7, 2009
  19. Nicolas PitreDec 7, 2009
  20. Junio C HamanoDec 7, 2009
  21. Nanako ShiraishiDec 7, 2009
  22. Jeff KingDec 8, 2009
  23. Jeff KingDec 8, 2009
  24. Ilari LiusvaaraDec 7, 2009
  25. Junio C HamanoDec 7, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.