Merge branch 'master' of github.com:jedisct1/dnscrypt-proxy

* 'master' of github.com:jedisct1/dnscrypt-proxy:
  Fix systemd socket support
This commit is contained in:
Frank Denis 2018-01-25 14:16:45 +01:00
commit f6a9229e2f
1 changed files with 12 additions and 8 deletions

View File

@ -9,18 +9,22 @@ import (
) )
func (proxy *Proxy) SystemDListeners() error { func (proxy *Proxy) SystemDListeners() error {
listeners, err := activation.Listeners(true) listeners, err := activation.Listeners(false)
if err != nil && len(listeners) > 0 { if err == nil && len(listeners) > 0 {
for i, listener := range listeners { for i, listener := range listeners {
dlog.Noticef("Wiring systemd TCP socket #%d", i) if listener != nil {
proxy.tcpListener(listener.(*net.TCPListener)) dlog.Noticef("Wiring systemd TCP socket #%d", i)
go proxy.tcpListener(listener.(*net.TCPListener))
}
} }
} }
packetConns, err := activation.PacketConns(true) packetConns, err := activation.PacketConns(false)
if err != nil && len(packetConns) > 0 { if err == nil && len(packetConns) > 0 {
for i, packetConn := range packetConns { for i, packetConn := range packetConns {
dlog.Noticef("Wiring systemd UDP socket #%d", i) if packetConn != nil {
proxy.udpListener(packetConn.(*net.UDPConn)) dlog.Noticef("Wiring systemd UDP socket #%d", i)
go proxy.udpListener(packetConn.(*net.UDPConn))
}
} }
} }
return nil return nil