Skip to content

Commit

Permalink
Quick fix thread unsafe dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn1m committed Mar 6, 2019
1 parent 058f993 commit 78c0ace
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/inbound/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ func (s *Server) Run() {
func (s *Server) ServeDNS(w dns.ResponseWriter, q *dns.Msg) {

inboundIP, _, _ := net.SplitHostPort(w.RemoteAddr().String())
s.dispatcher.InboundIP = inboundIP
s.dispatcher.QuestionMessage = q
currentDispatcher := s.dispatcher
currentDispatcher.InboundIP = inboundIP
currentDispatcher.QuestionMessage = q

log.Debug("Question from " + inboundIP + ": " + q.Question[0].String())

Expand All @@ -134,7 +135,7 @@ func (s *Server) ServeDNS(w dns.ResponseWriter, q *dns.Msg) {
}
}

responseMessage := s.dispatcher.Exchange()
responseMessage := currentDispatcher.Exchange()

if responseMessage == nil {
return
Expand Down

0 comments on commit 78c0ace

Please sign in to comment.