git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: David Turner <David.Turner@twosigma.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
	"spearce@spearce.org" <spearce@spearce.org>
Subject: Re: [PATCH] remote-curl: don't hang when a server dies before any output
Date: Mon, 14 Nov 2016 18:48:47 -0500	[thread overview]
Message-ID: <20161114234847.2nexsgedpg7zvrr5@sigill.intra.peff.net> (raw)
In-Reply-To: <a57cc9c4a0a840baab5b8123fac9388b@exmbdft7.ad.twosigma.com>

On Mon, Nov 14, 2016 at 11:25:30PM +0000, David Turner wrote:

> > But it does seem to work. At least it doesn't seem to break anything
> > in the test suite, and it fixes the new tests you added. I'd worry
> > that there's some obscure case where the response isn't packetized
> > in the same way.
> 
> Overall, this looks good to me.  The state machine is pretty clean. I
> think I would have used a tiny buffer for the length field, and then I
> would have regretted it.  Your way looks nicer than my unwritten patch
> would have looked.

Heh, I started it that way but you end up dealing with the same states
(they're just implicit in your "how big is my temp buffer" field).

> > +#define READ_ONE_HEX(shift) do { \
> > +	int val = hexval(buf[0]); \
> > +	if (val < 0) { \
> > +		warning("error on %d", *buf); \
> > +		rpc->pktline_state = RPC_PKTLINE_ERROR; \
> > +		return; \
> > +	} \
> > +	rpc->pktline_len |= val << shift; \
> 
> Nit: parenthesize shift here, since it is a parameter to a macro.

Yeah, I'm often a bit slack on these one-off inside-a-function macros.
But it does not hurt to to be careful.

I'll make that change and then try to wrap this up with a commit
message. I plan to steal your tests, if that's OK.

-Peff

  reply	other threads:[~2016-11-14 23:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-09 22:18 [PATCH] remote-curl: don't hang when a server dies before any output David Turner
2016-11-14 18:24 ` Jeff King
2016-11-14 19:40   ` Jeff King
2016-11-14 21:19     ` Junio C Hamano
2016-11-14 21:33       ` Jeff King
2016-11-14 23:25     ` David Turner
2016-11-14 23:48       ` Jeff King [this message]
2016-11-15 15:45         ` David Turner
2016-11-15  0:44     ` Jeff King
2016-11-15  1:02       ` Junio C Hamano
2016-11-15  3:58         ` Jeff King
2016-11-15 17:42           ` Junio C Hamano
2016-11-18 17:01             ` Jeff King
2016-11-18 17:04               ` David Turner
2016-11-18 17:08                 ` Jeff King
2016-11-18 17:48                   ` David Turner
2016-11-18 18:28               ` Junio C Hamano
2016-11-15  2:40       ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20161114234847.2nexsgedpg7zvrr5@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=David.Turner@twosigma.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).