[Sheepdog] [PATCH 4/4] sheep: set poll timeout

Yibin Shen zituan at taobao.com
Fri Dec 16 02:28:41 CET 2011


why another patch to set timeout?
seems conflict with 74890c48f797acfbb8fc9e0ff4f9592b4977a607

On Fri, Dec 16, 2011 at 6:01 AM, MORITA Kazutaka
<morita.kazutaka at lab.ntt.co.jp> wrote:
> Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
> ---
>  sheep/store.c |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
>
> diff --git a/sheep/store.c b/sheep/store.c
> index 70f9011..43089ce 100644
> --- a/sheep/store.c
> +++ b/sheep/store.c
> @@ -352,11 +352,20 @@ static int forward_write_obj_req(struct request *req)
>
>        ret = SD_RES_SUCCESS;
>  again:
> -       if (poll(pfds, nr_fds, -1) < 0) {
> +       pollret = poll(pfds, nr_fds, DEFAULT_SOCKET_TIMEOUT * 1000);
> +       if (pollret < 0) {
>                if (errno == EINTR)
>                        goto again;
>
>                ret = SD_RES_EIO;
> +       } else if (pollret == 0) { /* poll time out */
> +               eprintf("timeout\n");
> +
> +               for (i = 0; i < nr_fds; i++)
> +                       del_sheep_fd(pfds[i].fd);
> +
> +               ret = SD_RES_NETWORK_ERROR;
> +               goto out;
>        }
>
>        for (i = 0; i < nr_fds; i++) {
> --
> 1.7.2.5
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog

________________________________

This email (including any attachments) is confidential and may be legally privileged. If you received this email in error, please delete it immediately and do not copy it or use it for any purpose or disclose its contents to any other person. Thank you.

本电邮(包括任何附件)可能含有机密资料并受法律保护。如您不是正确的收件人,请您立即删除本邮件。请不要将本电邮进行复制并用作任何其他用途、或透露本邮件之内容。谢谢。



More information about the sheepdog mailing list