Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,28 @@ public String getLocalIP(boolean ipv6) {

final Iterator<Map.Entry<String, InetAddress>> it = addressMap.entrySet().iterator();
Map.Entry<String, InetAddress> kvp;
String host = null;
while (it.hasNext()) {
kvp = it.next();
final InetAddress address = kvp.getValue();
if(kvp.getKey().equals(USB_INTERFACE_NAME)){
continue;
}
return address.getHostAddress();
final String interfaceName = kvp.getKey();

if(kvp.getKey().equals(USB_INTERFACE_NAME)){
continue;
}
if(interfaceName.startsWith("wlan")) {
return address.getHostAddress();
} else {
host = address.getHostAddress();
}

// if(kvp.getKey().equals(USB_INTERFACE_NAME)){
// continue;
// }
// return address.getHostAddress();
}
if(host != null)
return host;
return addressMap.values().iterator().next().getHostAddress();
}
} catch (SocketException ex) {
Expand Down
6 changes: 5 additions & 1 deletion imsdroid/src/org/doubango/imsdroid/Screens/ScreenNatt.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ protected void onPause() {
mConfigurationService.putBoolean(NgnConfigurationEntry.NATT_USE_ICE, mCbEnableIce.isChecked());
mConfigurationService.putBoolean(NgnConfigurationEntry.NATT_STUN_DISCO, mRbDiscoStun.isChecked());
mConfigurationService.putString(NgnConfigurationEntry.NATT_STUN_SERVER, mEtStunStunHostname.getText().toString());
mConfigurationService.putString(NgnConfigurationEntry.NATT_STUN_PORT, mEtStunPort.getText().toString());
try {
mConfigurationService.putInt(NgnConfigurationEntry.NATT_STUN_PORT, Integer.parseInt(mEtStunPort.getText().toString()));
} catch(NumberFormatException e) {
Log.e(TAG, "stun port must be an integer");
}
mConfigurationService.putString(NgnConfigurationEntry.NATT_STUN_USERNAME, mEtStunUsername.getText().toString());
mConfigurationService.putString(NgnConfigurationEntry.NATT_STUN_PASSWORD, mEtStunPassword.getText().toString());

Expand Down