-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathNxt$4.java
More file actions
39 lines (36 loc) · 1.03 KB
/
Nxt$4.java
File metadata and controls
39 lines (36 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.Iterator;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
class Nxt$4
implements Runnable
{
private final JSONObject getPeersRequest = new JSONObject();
Nxt$4(Nxt paramNxt)
{
this.getPeersRequest.put("requestType", "getPeers");
}
public void run()
{
try
{
Nxt.Peer localPeer = Nxt.Peer.getAnyPeer(1, true);
if (localPeer != null)
{
JSONObject localJSONObject = localPeer.send(this.getPeersRequest);
if (localJSONObject != null)
{
JSONArray localJSONArray = (JSONArray)localJSONObject.get("peers");
Iterator localIterator = localJSONArray.iterator();
while (localIterator.hasNext())
{
Object localObject = localIterator.next();
String str = ((String)localObject).trim();
if (str.length() > 0) {
Nxt.Peer.addPeer(str, str);
}
}
}
}
}
catch (Exception localException) {}
}