Пример #1
0
func (t *ipTransport) Start() {
	config := server.Config{
		Port:      t.config.Port,
		Context:   t.context,
		Database:  t.database,
		Container: t.container,
		Device:    t.device,
		Mutex:     t.mutex,
		Emitter:   t.emitter,
	}

	s := server.NewServer(config)
	t.server = s
	port := to.Int64(s.Port())

	mdns := NewMDNSService(t.name, t.device.Name(), int(port))
	t.mdns = mdns

	// Paired accessories must not be reachable for other clients since iOS 9
	if t.isPaired() {
		mdns.SetReachable(false)
	}

	mdns.Publish()

	// Listen until server.Stop() is called
	s.ListenAndServe()
}
Пример #2
0
func (t *ipTransport) Start() {
	s := server.NewServer(t.context, t.database, t.container, t.device, t.mutex)
	t.server = s
	port := to.Int64(s.Port())

	mdns := NewMDNSService(t.name, t.device.Name(), int(port))
	t.mdns = mdns

	mdns.Publish()
	// Listen until server.Stop() is called
	s.ListenAndServe()
}
Пример #3
0
func (t *ipTransport) Start() {
	s := server.NewServer(t.context, t.database, t.container, t.device, t.mutex)
	t.server = s
	port := to.Int64(s.Port())

	mdns := NewMDNSService(t.name, t.device.Name(), int(port))
	t.mdns = mdns

	dns := t.database.DNSWithName(t.name)
	if dns == nil {
		dns = db.NewDNS(t.name, 1, 1)
		t.database.SaveDNS(dns)
	}
	mdns.Publish()
	// Listen until server.Stop() is called
	s.ListenAndServe()
}