Code Optimization

This commit is contained in:
Kioubit 2021-12-24 16:58:44 -05:00
parent 2dde03d5c4
commit a1d77463da

View File

@ -162,12 +162,16 @@ func getAddressFromQuestionListRetry(targetIP []byte, ndpQuestionChan chan *ndpQ
if success { if success {
return result, true return result, true
} }
select { forloop:
case q := <-ndpQuestionChan: for {
ndpQuestionsList = append(ndpQuestionsList, q) select {
default: case q := <-ndpQuestionChan:
return nil, false ndpQuestionsList = append(ndpQuestionsList, q)
default:
break forloop
}
} }
result, success = getAddressFromQuestionList(targetIP, ndpQuestionsList) result, success = getAddressFromQuestionList(targetIP, ndpQuestionsList)
return result, success return result, success
} }