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:
commit
f6a9229e2f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue