示例#1
0
func NewNodeDaemon(bindAddr string) (*NodeDaemon, error) {
	us := NodeID(fmt.Sprint(time.Now().UnixNano())) // XXX

	l, err := net.Listen("tcp", bindAddr)
	if err != nil {
		return nil, err
	}

	nd := &NodeDaemon{
		us:           us,
		listener:     l,
		connectivity: propagation.NewConnectivity(us),
	}

	go nd.acceptConnections()
	return nd, nil
}
示例#2
0
文件: comms.go 项目: dpw/monotreme
func NewNodeDaemon(bindAddr string) (*NodeDaemon, error) {
	us := newNodeID()

	l, err := net.Listen("tcp", bindAddr)
	if err != nil {
		return nil, err
	}

	nd := &NodeDaemon{
		us:           us,
		listener:     l,
		connectivity: propagation.NewConnectivity(us),
	}

	go nd.acceptConnections()
	return nd, nil
}