Re: [PATCH 08/12] upload-pack: move keepalive to upload_pack_data
- From
Jeff King <peff@peff.net>
- Date
- May 27, 2020, 18:38 UTC
- Message-ID
- <20200527183820.GF4020820@coredump.intra.peff.net>
- In-Reply-To
- <20200527164742.23067-9-chriscool@tuxfamily.org>
On Wed, May 27, 2020 at 06:47:38PM +0200, Christian Couder wrote:
Show 5 quoted lines
> As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' > more thoroughly, let's move the 'keepalive' static variable > into this struct. > > It is used by code common to protocol v0 and protocol v2.
Sounds good.
Show 20 quoted lines
> @@ -248,7 +250,7 @@ static void create_pack_file(struct upload_pack_data *pack_data)
>
> while (1) {
> struct pollfd pfd[2];
> - int pe, pu, pollsize;
> + int pe, pu, pollsize, polltimeout;
> int ret;
>
> reset_timeout(pack_data->timeout);
> @@ -272,8 +274,11 @@ static void create_pack_file(struct upload_pack_data *pack_data)
> if (!pollsize)
> break;
>
> - ret = poll(pfd, pollsize,
> - keepalive < 0 ? -1 : 1000 * keepalive);
> + polltimeout = pack_data->keepalive < 0
> + ? -1
> + : 1000 * pack_data->keepalive;
> +
> + ret = poll(pfd, pollsize, polltimeout);The new variable isn't strictly necessary, but it keeps the line-length down now that the variable name is much longer. Looks reasonable.
-Peff