Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build window fail #2

Open
zuozhehao opened this issue Mar 28, 2022 · 4 comments
Open

Build window fail #2

zuozhehao opened this issue Mar 28, 2022 · 4 comments

Comments

@zuozhehao
Copy link

goroutine 18 [running]:
github.com/brutella/dnssd.(*Service).IPsAtInterface(0xc0000736b8, 0x0)
        D:/***/github.com/brutella/dnssd@v1.2.2/service.go:150 +0x3d
github.com/brutella/dnssd.A({{0xc000212020, 0x4}, {0x6d4654, 0x9}, {0x6d3039, 0x5}, {0xc000212024, 0xc}, 0xc000206120, 0x0, ...}, ...)
        D:/***/github.com/brutella/dnssd@v1.2.2/dns.go:116 +0x39
github.com/brutella/dnssd.containsConflictingAnswers(0xc000406090, 0xc000214020)
        D:/***/github.com/brutella/dnssd@v1.2.2/responder.go:465 +0xbb
github.com/brutella/dnssd.findConflicts(0xc000406090, {0xc00040a010, 0x1, 0x1?})
        D:/***/github.com/brutella/dnssd@v1.2.2/responder.go:446 +0x9b
github.com/brutella/dnssd.(*responder).handleRequest(0xc000210000, 0xc000406090)
        D:/***/github.com/brutella/dnssd@v1.2.2/responder.go:238 +0x195
github.com/brutella/dnssd.(*responder).respond(0xc000210000, {0x775710, 0xc00022c040})
        D:/***/github.com/brutella/dnssd@v1.2.2/responder.go:203 +0x1d4
github.com/brutella/dnssd.(*responder).Respond(0xc000210000, {0x775710, 0xc00022c040})
        D:/***/github.com/brutella/dnssd@v1.2.2/responder.go:113 +0x3ef
github.com/brutella/hap.(*Server).listenAndServe.func1()
        D:/***/github.com/brutella/hap@v0.0.14/server.go:205 +0x37
created by github.com/brutella/hap.(*Server).listenAndServe
        D:/***/github.com/brutella/hap@v0.0.14/server.go:204 +0x465

Process finished with the exit code 2

Same question brutella/hc#201

@brutella
Copy link
Owner

I'm still confused on why s.ifaceIPs is nil only on Windows? Doesn't make any sense!

@zuozhehao
Copy link
Author

I'm still confused on why s.ifaceIPs is nil only on Windows? Doesn't make any sense!

I haven't added any code yet, just use the example code

package main

import (
	"github.com/brutella/hap"
	"github.com/brutella/hap/accessory"

	"context"
	"log"
	"os"
	"os/signal"
	"syscall"
)

func main() {
	// Create the switch accessory.
	a := accessory.NewSwitch(accessory.Info{
		Name: "Lamp",
	})

	// Store the data in the "./db" directory.
	fs := hap.NewFsStore("./db")

	// Create the hap server.
	server, err := hap.NewServer(fs, a.A)
	if err != nil {
		// stop if an error happens
		log.Panic(err)
	}

	// Setup a listener for interrupts and SIGTERM signals
	// to stop the server.
	c := make(chan os.Signal)
	signal.Notify(c, os.Interrupt)
	signal.Notify(c, syscall.SIGTERM)

	ctx, cancel := context.WithCancel(context.Background())
	go func() {
		<-c
		// Stop delivering signals.
		signal.Stop(c)
		// Cancel the context to stop the server.
		cancel() 
	}()

	// Run the server.
	server.ListenAndServe(ctx)
}

@hepeichun
Copy link

I'm still confused on why s.ifaceIPs is nil only on Windows? Doesn't make any sense!

I haven't added any code yet, just use the example code

package main

import (
	"github.com/brutella/hap"
	"github.com/brutella/hap/accessory"

	"context"
	"log"
	"os"
	"os/signal"
	"syscall"
)

func main() {
	// Create the switch accessory.
	a := accessory.NewSwitch(accessory.Info{
		Name: "Lamp",
	})

	// Store the data in the "./db" directory.
	fs := hap.NewFsStore("./db")

	// Create the hap server.
	server, err := hap.NewServer(fs, a.A)
	if err != nil {
		// stop if an error happens
		log.Panic(err)
	}

	// Setup a listener for interrupts and SIGTERM signals
	// to stop the server.
	c := make(chan os.Signal)
	signal.Notify(c, os.Interrupt)
	signal.Notify(c, syscall.SIGTERM)

	ctx, cancel := context.WithCancel(context.Background())
	go func() {
		<-c
		// Stop delivering signals.
		signal.Stop(c)
		// Cancel the context to stop the server.
		cancel() 
	}()

	// Run the server.
	server.ListenAndServe(ctx)
}

@brutella @zuozhehao
This might have something to do with IPv6.

@zuozhehao
Copy link
Author

zuozhehao commented Jun 29, 2022

https://github.com/brutella/dnssd/blob/master/mdns.go#L146

image

I think it should be caused here.


https://github.com/brutella/dnssd/blob/master/mdns.go#L220

it's error message read udp4 0.0.0.0:5353: use of closed network connection

@brutella

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants