Revert "Remove reverse DNS"

This reverts commit 18d799e9f0.
This commit is contained in:
M66B 2016-08-01 19:21:22 +02:00
parent f0fe4d7565
commit a5b1d3cf31
1 changed files with 27 additions and 0 deletions

View File

@ -130,6 +130,33 @@ public class AdapterAccess extends CursorAdapter {
Util.getProtocolName(protocol, version, true) +
" " + daddr + (dport > 0 ? "/" + dport : ""));
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 {
return InetAddress.getByName(args[0]).getHostName();
} catch (UnknownHostException ignored) {
return args[0];
}
}
@Override
protected void onPostExecute(String addr) {
Object tag = tvDest.getTag();
if (tag != null && (Long) tag == id)
tvDest.setText(
Util.getProtocolName(protocol, version, true) +
" >" + addr + (dport > 0 ? "/" + dport : ""));
tvDest.setTag(null);
}
}.execute(daddr);
if (allowed < 0)
tvDest.setTextColor(colorText);
else if (allowed > 0)