summaryrefslogtreecommitdiffhomepage
path: root/ui/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'ui/src/main')
-rw-r--r--ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt17
1 files changed, 1 insertions, 16 deletions
diff --git a/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt b/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt
index 55c84df5..97aae280 100644
--- a/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt
+++ b/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt
@@ -203,22 +203,7 @@ class ObservableTunnel internal constructor(
private fun onEndpointChanged(publicKey: Key, newEndpoint: InetEndpoint?) {
Log.i(TAG, "ObservableTunnel onEndpointChange " + newEndpoint)
- var peer: PeerDetail? = null
-
- configDetail?.peers?.forEach {
- if (it.publicKey.equals(publicKey) == true) {
- Log.i(TAG, "ObservableTunnel peer " + it + ", " + it.peer)
- peer = it;
- }
- }
-
- if (peer == null) {
- Log.i(TAG, "ObservableTunnel create peer " + publicKey)
- peer = PeerDetail(publicKey)
- configDetail?.peers?.add(peer)
- }
-
- var peer2: PeerDetail = peer!!
+ var peer2: PeerDetail = lookupPeer(publicKey)
if (newEndpoint != null) {
peer2.endpoint = newEndpoint.getResolved()