Re: [PATCH 08/12] upload-pack: move keepalive to upload_pack_data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 27, 2020 at 06:47:38PM +0200, Christian Couder wrote:

> 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.

> @@ -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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux