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

Hitoshi Mitake h.mitake at gmail.com
Fri Jan 18 04:33:07 CET 2013


At Fri, 18 Jan 2013 10:25:54 +0800,
Liu Yuan wrote:
> 
> 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, these functions are helpful. I'll use them from v7.

Thanks,
Hitoshi



More information about the sheepdog mailing list