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 {
listeners, err := activation.Listeners(true)
if err != nil && len(listeners) > 0 {
listeners, err := activation.Listeners(false)
if err == nil && len(listeners) > 0 {
for i, listener := range listeners {
dlog.Noticef("Wiring systemd TCP socket #%d", i)
proxy.tcpListener(listener.(*net.TCPListener))
if listener != nil {
dlog.Noticef("Wiring systemd TCP socket #%d", i)
go proxy.tcpListener(listener.(*net.TCPListener))
}
}
}
packetConns, err := activation.PacketConns(true)
if err != nil && len(packetConns) > 0 {
packetConns, err := activation.PacketConns(false)
if err == nil && len(packetConns) > 0 {
for i, packetConn := range packetConns {
dlog.Noticef("Wiring systemd UDP socket #%d", i)
proxy.udpListener(packetConn.(*net.UDPConn))
if packetConn != nil {
dlog.Noticef("Wiring systemd UDP socket #%d", i)
go proxy.udpListener(packetConn.(*net.UDPConn))
}
}
}
return nil