mirror of
https://github.com/M66B/NetGuard.git
synced 2024-12-27 02:09:41 +00:00
Prevent double name lookups
This commit is contained in:
parent
bb3f4bf212
commit
46b054b9f8
2 changed files with 30 additions and 19 deletions
|
@ -117,9 +117,13 @@ public class AdapterAccess extends CursorAdapter {
|
|||
Util.getProtocolName(protocol, version, true) +
|
||||
" " + daddr + (dport > 0 ? "/" + dport : ""));
|
||||
|
||||
if (Util.isNumericAddress(daddr)) {
|
||||
tvDest.setTag(id);
|
||||
if (Util.isNumericAddress(daddr) && tvDest.getTag() == null)
|
||||
new AsyncTask<String, Object, String>() {
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
tvDest.setTag(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(String... args) {
|
||||
try {
|
||||
|
@ -135,9 +139,9 @@ public class AdapterAccess extends CursorAdapter {
|
|||
tvDest.setText(
|
||||
Util.getProtocolName(protocol, version, true) +
|
||||
" " + addr + (dport > 0 ? "/" + dport : ""));
|
||||
tvDest.setTag(null);
|
||||
}
|
||||
}.execute(daddr);
|
||||
}
|
||||
|
||||
if (allowed < 0)
|
||||
tvDest.setTextColor(colorText);
|
||||
|
|
|
@ -220,9 +220,14 @@ public class AdapterLog extends CursorAdapter {
|
|||
|
||||
if (resolve && !isKnownAddress(daddr))
|
||||
if (dname == null) {
|
||||
if (tvDaddr.getTag() == null) {
|
||||
tvDaddr.setText(daddr);
|
||||
tvDaddr.setTag(id);
|
||||
new AsyncTask<String, Object, String>() {
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
tvDaddr.setTag(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(String... args) {
|
||||
try {
|
||||
|
@ -236,8 +241,10 @@ public class AdapterLog extends CursorAdapter {
|
|||
protected void onPostExecute(String name) {
|
||||
if ((Long) tvDaddr.getTag() == id)
|
||||
tvDaddr.setText(name);
|
||||
tvDaddr.setTag(null);
|
||||
}
|
||||
}.execute(daddr);
|
||||
}
|
||||
} else
|
||||
tvDaddr.setText(dname);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue