[sheepdog] [PATCH v6 4/4] shepherd: a new cluster manager specialized for sheepdog

Liu Yuan namei.unix at gmail.com
Fri Jan 18 03:25:54 CET 2013


On 01/17/2013 10:25 AM, Hitoshi Mitake wrote:
> +			&opt, sizeof(opt));
> +	if (ret == -1)
> +		panic("setsockopt() for SO_REUSEADDR failed: %m\n");
> +
> +	memset(&listen_addr, 0, sizeof(listen_addr));
> +	listen_addr.sin_family = AF_INET;
> +	listen_addr.sin_port = port;
> +	memcpy(&listen_addr.sin_addr, addr + 12, sizeof(listen_addr.sin_addr));
> +
> +	ret = bind(sheep_listen_fd, &listen_addr, sizeof(struct sockaddr_in));
> +	if (ret == -1)
> +		panic("bind() failed: %m\n");
> +
> +	ret = listen(sheep_listen_fd, 1);
> +	if (ret == -1)
> +		panic("listen() failed: %m\n");
> +
> +	ret = register_event(sheep_listen_fd, sheep_accept_handler, NULL);
> +	if (ret)
> +		panic("register_event() failed: %m\n");

Why not  use create_listen_port() from lib/net.c?

Also I think you can use connect_to() too.

Thanks,
Yuan



More information about the sheepdog mailing list