Changeset View
Changeset View
Standalone View
Standalone View
support/aphlict/server/aphlict_server.js
| Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | throw new Error( | ||||
| 'documentation for instructions. ' + ex.toString()); | 'documentation for instructions. ' + ex.toString()); | ||||
| } | } | ||||
| // NOTE: Require these only after checking for the "ws" module, since they | // NOTE: Require these only after checking for the "ws" module, since they | ||||
| // depend on it. | // depend on it. | ||||
| require('./lib/AphlictAdminServer'); | require('./lib/AphlictAdminServer'); | ||||
| require('./lib/AphlictClientServer'); | require('./lib/AphlictClientServer'); | ||||
| require('./lib/AphlictPeerList'); | |||||
| require('./lib/AphlictPeer'); | |||||
| var ii; | var ii; | ||||
| var logs = config.logs || []; | var logs = config.logs || []; | ||||
| for (ii = 0; ii < logs.length; ii++) { | for (ii = 0; ii < logs.length; ii++) { | ||||
| debug.addLog(logs[ii].path); | debug.addLog(logs[ii].path); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | for (ii = 0; ii < servers.length; ii++) { | ||||
| if (is_client) { | if (is_client) { | ||||
| aphlict_clients.push(aphlict_server); | aphlict_clients.push(aphlict_server); | ||||
| } else { | } else { | ||||
| aphlict_admins.push(aphlict_server); | aphlict_admins.push(aphlict_server); | ||||
| } | } | ||||
| } | } | ||||
| var peer_list = new JX.AphlictPeerList(); | |||||
| debug.log( | |||||
| 'This server has fingerprint "%s".', | |||||
| peer_list.getFingerprint()); | |||||
| var cluster = config.cluster || []; | |||||
| for (ii = 0; ii < cluster.length; ii++) { | |||||
| var peer = cluster[ii]; | |||||
| var peer_client = new JX.AphlictPeer() | |||||
| .setHost(peer.host) | |||||
| .setPort(peer.port) | |||||
| .setProtocol(peer.protocol); | |||||
| peer_list.addPeer(peer_client); | |||||
| } | |||||
| for (ii = 0; ii < aphlict_admins.length; ii++) { | for (ii = 0; ii < aphlict_admins.length; ii++) { | ||||
| var admin_server = aphlict_admins[ii]; | var admin_server = aphlict_admins[ii]; | ||||
| admin_server.setClientServers(aphlict_clients); | admin_server.setClientServers(aphlict_clients); | ||||
| admin_server.setPeerList(peer_list); | |||||
| } | } | ||||