With a second review, I think this patch need more reviews.

On 07/26/2012 09:46 PM, Yunkai Zhang wrote:
> +int send_light_req(struct sd_req *hdr, const char *host, int port)
> +{
> +     int fd, ret;
> +     struct sd_rsp *rsp = (struct sd_rsp *)hdr;
> +     unsigned rlen, wlen;
> +
> +     fd = connect_to(host, port);
> +     if (fd < 0)
> +             return -1;
> +
> +     rlen = 0;
> +     wlen = 0;
> +     ret = exec_req(fd, hdr, NULL, &wlen, &rlen);
> +     close(fd);
> +
> +     if (ret) {
> +             return -1;
> +     }

Simply eprintf inside this function for connection failed

> +
> +     if (rsp->result != SD_RES_SUCCESS) {
> +             eprintf("Response's result: %s\n", sd_strerror(rsp->result));
> +             return 1;
> +     }
> +
> +     return 0;
> +}

Then use -1 for error case and 0 for success. No need to use both -1 and
1 to represent failure case.

Thanks,
Yuan

-- 
sheepdog mailing list
sheepdog@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to