Search in sources :

Example 16 with Peer

use of org.xel.peer.Peer in project elastic-core-maven by OrdinaryDude.

the class RemoveActivePeer method processRequest.

@Override
JSONStreamAware processRequest(HttpServletRequest req, User user) throws IOException {
    if (Users.allowedUserHosts == null && !InetAddress.getByName(req.getRemoteAddr()).isLoopbackAddress()) {
        return LOCAL_USERS_ONLY;
    } else {
        int index = Integer.parseInt(req.getParameter("peer"));
        Peer peer = Users.getPeer(index);
        if (peer != null && !peer.isBlacklisted()) {
            peer.deactivate();
        }
    }
    return null;
}
Also used : Peer(org.xel.peer.Peer)

Aggregations

Peer (org.xel.peer.Peer)16 JSONObject (org.json.simple.JSONObject)9 JSONArray (org.json.simple.JSONArray)6 Block (org.xel.Block)2 ArrayList (java.util.ArrayList)1 JSONStreamAware (org.json.simple.JSONStreamAware)1 BlockchainProcessor (org.xel.BlockchainProcessor)1 Transaction (org.xel.Transaction)1