Fix data race

This commit is contained in:
Frank Denis 2020-03-20 21:45:09 +01:00
parent 44db53f58b
commit 0b87cc92b6
1 changed files with 7 additions and 7 deletions

View File

@ -199,23 +199,23 @@ func dnsExchange(proxy *Proxy, proto string, query *dns.Msg, serverAddress strin
options := 0 options := 0
for tries := 1; tries >= 0; tries-- { for tries := 1; tries >= 0; tries-- {
if tryFragmentsSupport { if tryFragmentsSupport && false {
go func() { go func(query *dns.Msg, delay time.Duration) {
time.Sleep(time.Duration(10*tries) * time.Millisecond) time.Sleep(delay)
option := _dnsExchange(proxy, proto, query, serverAddress, relayUDPAddr, relayTCPAddr, 1500) option := _dnsExchange(proxy, proto, query, serverAddress, relayUDPAddr, relayTCPAddr, 1500)
option.fragmentsBlocked = false option.fragmentsBlocked = false
option.priority = 0 option.priority = 0
channel <- option channel <- option
}() }(query.Copy(), time.Duration(10*tries)*time.Millisecond)
options++ options++
} }
go func() { go func(query *dns.Msg, delay time.Duration) {
time.Sleep(time.Duration(15*tries) * time.Millisecond) time.Sleep(delay)
option := _dnsExchange(proxy, proto, query, serverAddress, relayUDPAddr, relayTCPAddr, 480) option := _dnsExchange(proxy, proto, query, serverAddress, relayUDPAddr, relayTCPAddr, 480)
option.fragmentsBlocked = true option.fragmentsBlocked = true
option.priority = 1 option.priority = 1
channel <- option channel <- option
}() }(query.Copy(), time.Duration(15*tries)*time.Millisecond)
options++ options++
} }
var bestOption *dnsExchangeResponse var bestOption *dnsExchangeResponse