Skip to content

Commit

Permalink
Fixed hang issue on ping/resolve address
Browse files Browse the repository at this point in the history
  • Loading branch information
ukanth committed Dec 24, 2018
1 parent cbfd8c2 commit dd030a4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 66 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog AFWall+
==================

Version 3.0.4
* Fix: domain names resolve
* Fix: Removed notification dot on all notifications
* Fix: Inbound option causing firewall disable functionality
* Removed SUPER_USER permission which is not relevant anymore

Version 3.0.3

* Fix: Disable firewall issue
Expand Down
2 changes: 1 addition & 1 deletion aFWall/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 21
targetSdkVersion 26
versionCode 17000
versionName "3.1.0-BETA"
versionName "3.0.4"
//buildConfigField 'boolean', 'DONATE', 'true'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,7 @@ public boolean onContextItemSelected(MenuItem item) {
String[] items = {current_selected_logData.getDst(), current_selected_logData.getSrc()};
new MaterialDialog.Builder(this)
.items(items)
.itemsCallbackSingleChoice(-1, new MaterialDialog.ListCallbackSingleChoice() {
@Override
public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
return true;
}
})
.itemsCallbackSingleChoice(-1, (dialog, view, which, text) -> true)
.positiveText(R.string.choose)
.show();
break;
Expand All @@ -149,12 +144,9 @@ public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequ
.title(R.string.destination_address)
.neutralText(R.string.OK)
.positiveText(R.string.copy_text)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
Api.copyToClipboard(LogDetailActivity.this, current_selected_logData.getDst() + ":" + current_selected_logData.getDpt());
Api.toast(LogDetailActivity.this, getString(R.string.destination_copied));
}
.onPositive((dialog, which) -> {
Api.copyToClipboard(LogDetailActivity.this, current_selected_logData.getDst() + ":" + current_selected_logData.getDpt());
Api.toast(LogDetailActivity.this, getString(R.string.destination_copied));
})
.show();

Expand All @@ -166,77 +158,42 @@ public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which)
.title(R.string.source_address)
.neutralText(R.string.OK)
.positiveText(R.string.copy_text)
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
Api.copyToClipboard(LogDetailActivity.this, current_selected_logData.getSrc() + ":" + current_selected_logData.getSpt());
Api.toast(LogDetailActivity.this, getString(R.string.source_copied));
}
.onPositive((dialog, which) -> {
Api.copyToClipboard(LogDetailActivity.this, current_selected_logData.getSrc() + ":" + current_selected_logData.getSpt());
Api.toast(LogDetailActivity.this, getString(R.string.source_copied));
})
.show();
break;

case 3: // Ping Destination
try {
new LogNetUtil.NetTask(this).execute(
new LogNetUtil.NetParam(
LogNetUtil.JobType.PING, current_selected_logData.getDst()
)
).get();

} catch (InterruptedException e) {
Log.e(TAG, "Exception(00): " + e.getMessage());
} catch (ExecutionException e) {
Log.e(TAG, "Exception(01): " + e.getMessage());
}
new LogNetUtil.NetTask(this).execute(
new LogNetUtil.NetParam(LogNetUtil.JobType.PING, current_selected_logData.getDst())
);

break;

case 4: // Ping Source
try {
new LogNetUtil.NetTask(this).execute(
new LogNetUtil.NetParam(
LogNetUtil.JobType.PING, current_selected_logData.getSrc()
)
).get();
} catch (InterruptedException e) {
Log.e(TAG, "Exception(03): " + e.getMessage());
} catch (ExecutionException e) {
Log.e(TAG, "Exception(04): " + e.getMessage());
}
new LogNetUtil.NetTask(this).execute(
new LogNetUtil.NetParam(LogNetUtil.JobType.PING, current_selected_logData.getSrc())
);
break;

case 5: // Resolve Destination
try {
new LogNetUtil.NetTask(this).execute(
new LogNetUtil.NetParam(
LogNetUtil.JobType.RESOLVE, current_selected_logData.getDst()
)
).get();
} catch (InterruptedException e) {
Log.e(TAG, "Exception(05): " + e.getMessage());
} catch (ExecutionException e) {
Log.e(TAG, "Exception(06): " + e.getMessage());
}
new LogNetUtil.NetTask(this).execute(
new LogNetUtil.NetParam(LogNetUtil.JobType.RESOLVE, current_selected_logData.getDst())
);
break;

case 6: // Resolve Source
try {
new LogNetUtil.NetTask(this).execute(
new LogNetUtil.NetParam(
LogNetUtil.JobType.RESOLVE, current_selected_logData.getSrc()
)
).get();
} catch (InterruptedException e) {
Log.e(TAG, "Exception(07): " + e.getMessage());
} catch (ExecutionException e) {
Log.e(TAG, "Exception(08): " + e.getMessage());
}
new LogNetUtil.NetTask(this).execute(
new LogNetUtil.NetParam(LogNetUtil.JobType.RESOLVE, current_selected_logData.getSrc())
);
break;
}
return super.onContextItemSelected(item);
}

public class NetTask extends AsyncTask<String, Integer, String> {
/* public class NetTask extends AsyncTask<String, Integer, String> {
@Override
protected String doInBackground(String... params) {
InetAddress addr = null;
Expand All @@ -248,7 +205,7 @@ protected String doInBackground(String... params) {
return addr.getCanonicalHostName().toString();
}
}

*/

private List<LogData> getLogData(final int uid) {
return SQLite.select()
Expand Down

0 comments on commit dd030a4

Please sign in to comment.