[sheepdog] [PATCH] reconnect in case of EINTR

Liu Yuan namei.unix at gmail.com
Mon May 6 07:05:08 CEST 2013


On 05/04/2013 05:19 PM, MORITA Kazutaka wrote:
> From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
> 
> Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
> ---
>  lib/net.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/net.c b/lib/net.c
> index ebb0da6..464ccb7 100644
> --- a/lib/net.c
> +++ b/lib/net.c
> @@ -245,9 +245,11 @@ int connect_to(const char *name, int port)
>  			close(fd);
>  			break;
>  		}
> -
> +reconnect:
>  		ret = connect(fd, res->ai_addr, res->ai_addrlen);
>  		if (ret) {
> +			if (errno == EINTR)
> +				goto reconnect;
>  			sd_eprintf("failed to connect to %s:%d: %m", name,
>  				   port);
>  			close(fd);
> 

Applied, thanks.

Yuan



More information about the sheepdog mailing list