Skip to content

Commit 78c0ace

Browse files
committed
Quick fix thread unsafe dispatcher
1 parent 058f993 commit 78c0ace

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

core/inbound/server.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ func (s *Server) Run() {
123123
func (s *Server) ServeDNS(w dns.ResponseWriter, q *dns.Msg) {
124124

125125
inboundIP, _, _ := net.SplitHostPort(w.RemoteAddr().String())
126-
s.dispatcher.InboundIP = inboundIP
127-
s.dispatcher.QuestionMessage = q
126+
currentDispatcher := s.dispatcher
127+
currentDispatcher.InboundIP = inboundIP
128+
currentDispatcher.QuestionMessage = q
128129

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

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

137-
responseMessage := s.dispatcher.Exchange()
138+
responseMessage := currentDispatcher.Exchange()
138139

139140
if responseMessage == nil {
140141
return

0 commit comments

Comments
 (0)