Merge pull request #738 from Arceliar/bugfix

Listener bugfix
This commit is contained in:
Arceliar 2020-11-07 05:51:04 -06:00 committed by GitHub
commit f1e9837a98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -191,7 +191,9 @@ func (m *Multicast) getAllowedInterfaces() map[string]net.Interface {
// Ask the system for network interfaces
allifaces, err := net.Interfaces()
if err != nil {
panic(err)
// Don't panic, since this may be from e.g. too many open files (from too much connection spam)
// TODO? log something
return nil
}
// Work out which interfaces to announce on
for _, iface := range allifaces {

View File

@ -226,7 +226,13 @@ func (t *tcp) listener(l *TcpListener, listenaddr string) {
sock, err := l.Listener.Accept()
if err != nil {
t.links.core.log.Errorln("Failed to accept connection:", err)
return
select {
case <-l.stop:
return
default:
}
time.Sleep(time.Second) // So we don't busy loop
continue
}
t.waitgroup.Add(1)
options := tcpOptions{