mirror of
https://github.com/yggdrasil-network/crispa-android.git
synced 2024-11-09 12:01:01 +00:00
2. getPeers parsing fixes
This commit is contained in:
parent
bca4b88d3d
commit
010051da50
@ -269,7 +269,7 @@ class MainActivity : AppCompatActivity() {
|
||||
thread(start = true) {
|
||||
while(true) {
|
||||
Thread.sleep(5000)
|
||||
if(isStarted) {
|
||||
if(isStarted && this.currentPeers.isEmpty()) {
|
||||
updatePeers()
|
||||
}
|
||||
}
|
||||
@ -297,7 +297,7 @@ class MainActivity : AppCompatActivity() {
|
||||
val listView = findViewById<ListView>(R.id.peers)
|
||||
val adapter = PeerInfoListAdapter(
|
||||
this@MainActivity,
|
||||
meshPeers.sortedWith(compareBy { it.ping })
|
||||
meshPeers.filter { it.schema!="self" }.sortedWith(compareBy { it.ping })
|
||||
)
|
||||
runOnUiThread {
|
||||
listView.adapter = adapter
|
||||
|
@ -6,6 +6,7 @@ import io.github.chronosx88.yggdrasil.models.PeerInfo
|
||||
import java.net.InetAddress
|
||||
import java.net.InetSocketAddress
|
||||
import java.net.Socket
|
||||
import java.net.URI
|
||||
|
||||
class Utils {
|
||||
|
||||
@ -119,11 +120,14 @@ class Utils {
|
||||
if(p.endpoint == "(self)"){
|
||||
out.add(PeerInfo(p.protocol, InetAddress.getByName("localhost"), p.port, null, true))
|
||||
} else {
|
||||
var fixWlanPart = p.endpoint.substring(p.endpoint.indexOf('%'), p.endpoint.indexOf(']'))
|
||||
var fixedUrlString = p.endpoint.replace(fixWlanPart, "")
|
||||
var url = URI(fixedUrlString)
|
||||
out.add(
|
||||
PeerInfo(
|
||||
p.protocol,
|
||||
InetAddress.getByName(p.endpoint),
|
||||
p.port,
|
||||
url.scheme,
|
||||
InetAddress.getByName(url.host),
|
||||
url.port,
|
||||
null,
|
||||
true
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user