Esempio n. 1
0
func (sa *ServiceAdmin) Listen(addr *skynet.BindAddr) {
	listener, err := addr.Listen()
	if err != nil {
		panic(err)
	}

	sa.service.Log.Item(AdminListening{sa.service.Config})

	for {
		conn, err := listener.AcceptTCP()
		if err != nil {
			panic(err)
		}
		go sa.rpc.ServeCodec(bsonrpc.NewServerCodec(conn))
	}
}
Esempio n. 2
0
func (s *Service) cleanupDoozerEntriesForAddr(addr *skynet.BindAddr) {
	if addr == nil {
		return
	}
	q := skynet.Query{
		Host:       addr.IPAddress,
		Port:       strconv.Itoa(addr.Port),
		DoozerConn: s.doozer(),
	}

	instances := q.FindInstances()

	for _, i := range instances {
		s.Log.Item("Cleaning up old doozer entry with conflicting addr " + addr.String() + "(" + i.GetConfigPath() + ")")
		s.doozer().Del(i.GetConfigPath(), s.doozer().GetCurrentRevision())
	}
}
Esempio n. 3
0
func (sa *ServiceAdmin) Listen(addr *skynet.BindAddr, bindWait *sync.WaitGroup) {
	listener, err := addr.Listen()
	if err != nil {
		panic(err)
	}

	bindWait.Done()

	sa.service.Log.Trace(fmt.Sprintf("%+v", AdminListening{sa.service.Config}))

	for {
		conn, err := listener.AcceptTCP()
		if err != nil {
			panic(err)
		}
		go sa.rpc.ServeCodec(bsonrpc.NewServerCodec(conn))
	}
}
Esempio n. 4
0
func (s *Service) listen(addr *skynet.BindAddr) {
	var err error
	s.rpcListener, err = addr.Listen()
	if err != nil {
		panic(err)
	}

	s.Log.Item(ServiceListening{
		Addr:          addr,
		ServiceConfig: s.Config,
	})

	for {
		conn, err := s.rpcListener.AcceptTCP()
		if err != nil {
			panic(err)
		}
		s.connectionChan <- conn
	}
}
Esempio n. 5
0
func (s *Service) listen(addr *skynet.BindAddr, bindWait *sync.WaitGroup) {
	var err error
	s.rpcListener, err = addr.Listen()
	if err != nil {
		panic(err)
	}

	s.Log.Trace(fmt.Sprintf("%+v", ServiceListening{
		Addr:          addr,
		ServiceConfig: s.Config,
	}))

	bindWait.Done()

	for {
		conn, err := s.rpcListener.AcceptTCP()
		if err != nil {
			panic(err)
		}
		s.connectionChan <- conn
	}
}