Search in sources :

Example 1 with IotaAPI

use of iota.IotaAPI in project isf-jclient by mikrohash.

the class NodeManager method connectToNode.

private static boolean connectToNode(final String node, final int api) {
    TimeAbortCall t = new TimeAbortCall(R.STR.getString("nodes_action_connecting"), 1) {

        @Override
        public boolean onCall() {
            String protocol = node.split(":")[0];
            String host = node.split(":")[1].replace("//", "");
            String port = node.split(":")[2];
            apis[api] = (IotaAPI) new IotaAPI.Builder().protocol(protocol).host(host).port(port).localPoW(new GOldDiggerLocalPoW()).build();
            return true;
        }
    };
    if (!t.call(CONNECTING_DURATION_TOLERACE))
        return false;
    String isNodeSynced = isNodeSynced(api);
    if (isNodeSynced != null)
        uim.logDbg(String.format(R.STR.getString("nodes_action_changing"), buildNodeAddress(api), api, isNodeSynced));
    return isNodeSynced == null;
}
Also used : GOldDiggerLocalPoW(iota.GOldDiggerLocalPoW) TimeAbortCall(isf.logic.TimeAbortCall) IotaAPI(iota.IotaAPI)

Aggregations

GOldDiggerLocalPoW (iota.GOldDiggerLocalPoW)1 IotaAPI (iota.IotaAPI)1 TimeAbortCall (isf.logic.TimeAbortCall)1