Skip to content

Commit

Permalink
1. #6. added multicast peers to peer list
Browse files Browse the repository at this point in the history
  • Loading branch information
vikulin committed Dec 7, 2020
1 parent c5344d5 commit fd6f741
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class MainActivity : AppCompatActivity() {
thread(start = true) {
while(true) {
Thread.sleep(5000)
if(isStarted && this.currentPeers.isEmpty()) {
if(isStarted) {
updatePeers()
}
}
Expand Down Expand Up @@ -340,9 +340,7 @@ class MainActivity : AppCompatActivity() {
when (resultCode) {
STATUS_START -> {
print("service started")
if (this.currentPeers.isEmpty()) {
checkPeers()
}
checkPeers()
}
STATUS_FINISH -> {
isStarted = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,13 @@ 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 fixWlanPart=""
if(p.endpoint.indexOf(']')>0) {
fixWlanPart = p.endpoint.substring(
p.endpoint.indexOf('%'),
p.endpoint.indexOf(']')
)
}
var fixedUrlString = p.endpoint.replace(fixWlanPart, "")
var url = URI(fixedUrlString)
out.add(
Expand Down

0 comments on commit fd6f741

Please sign in to comment.