Removed IsInflightQuery that is done by IP address now

This commit is contained in:
Bryan Boreham committed 2014-10-08 13:49:20 +01:00
1 parent d234fe9506
commit 6506b63520
1 file changed
-29
-29
View File
@@ -101,7 +101,6 @@ func LinkLocalMulticastListener(ifi *net.Interface) (net.PacketConn, error) {
const (
CSendQuery = iota
CShutdown = iota
CIsInflightQuery = iota
CMessageReceived = iota
)
@@ -124,18 +123,6 @@ func (c *MDNSClient) SendQuery(name string, querytype uint16, responseCh chan<-
}
}
// Sync
func (c *MDNSClient) IsInflightQuery(m *dns.Msg) bool {
resultChan := make(chan interface{})
c.queryChan <- &MDNSInteraction{
code: CIsInflightQuery,
resultChan: resultChan,
payload: m,
}
result := <-resultChan
return result.(bool)
}
// Async - called from dns library multiplexer
func (c *MDNSClient) ResponseCallback(r *dns.Msg) {
c.queryChan <- &MDNSInteraction{code: CMessageReceived, payload: r}
@@ -191,8 +178,6 @@ func (c *MDNSClient) queryLoop(queryChan <-chan *MDNSInteraction) {
case CSendQuery:
err = c.handleSendQuery(query.payload.(mDNSQueryInfo))
run()
case CIsInflightQuery:
query.resultChan <- c.handleIsInflightQuery(query.payload.(*dns.Msg))
case CMessageReceived:
c.handleResponse(query.payload.(*dns.Msg))
run()
@@ -230,20 +215,6 @@ func (c *MDNSClient) handleSendQuery(q mDNSQueryInfo) (err error) {
return err
}
func (c *MDNSClient) handleIsInflightQuery(m *dns.Msg) bool {
if len(m.Question) == 1 {
q := m.Question[0]
if q.Qtype == dns.TypeA {
if query, found := c.inflight[q.Name]; found {
if query.Id == m.Id {
return true
}
}
}
}
return false
}
func (c *MDNSClient) handleResponse(r *dns.Msg) {
for _, answer := range r.Answer {
switch rr := answer.(type) {