import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
+import net.pterodactylus.fcp.highlevel.FcpClient;
+import net.pterodactylus.fcp.highlevel.FcpException;
import net.pterodactylus.jsite.util.IdGenerator;
import net.pterodactylus.util.io.Closer;
import net.pterodactylus.util.logging.Logging;
/** Map from node ID to node. */
private final Map<String, Node> idNodes = Collections.synchronizedMap(new HashMap<String, Node>());
+ /** Map from node to client. */
+ private final Map<Node, FcpClient> nodeClients = Collections.synchronizedMap(new HashMap<Node, FcpClient>());
+
/** Collection of currently connected nodes. */
private final Set<Node> connectedNodes = Collections.synchronizedSet(new HashSet<Node>());
logger.log(Level.WARNING, "Was told to connect to node (" + node + ") I don’t know about!");
return;
}
+ try {
+ FcpClient fcpClient = new FcpClient(clientName, node.getHostname(), node.getPort());
+ fcpClient.connect();
+ } catch (UnknownHostException uhe1) {
+ nodeListenerSupport.fireNodeConnectionFailed(node, uhe1);
+ } catch (IOException ioe1) {
+ nodeListenerSupport.fireNodeConnectionFailed(node, ioe1);
+ } catch (FcpException fe1) {
+ nodeListenerSupport.fireNodeConnectionFailed(node, fe1);
+ }
}
/**