Warning: session_start(): open(/var/lib/php/sessions/sess_rnbvafv3mmfcc3k5998ar5cg7b, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
!include once #1002615 // master()
// Options for smaller heap with limit to allow other VMs to start on 1GB machine. Also, headless to allow image rendering on server.
static S vmArgs = "-Xmx256m -XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=10 -XX:+UseG1GC -Djava.awt.headless=true";
// Options for smaller heap
//static S vmArgs = "-XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=10 -XX:+UseG1GC";
// Options for max speed & reactivity - some claim this might cause problems (https://developer.jboss.org/thread/228920?start=75&tstart=0)
//static S vmArgs = "-server -XX:+TieredCompilation";
// Options for max longterm throughput
//static S vmArgs = "-server";
// Homepage, Talk to Eleu, Web Auth, Cookies
static L seedBots = litlist("#1003253", "#1002213", "#1002590", "#1002157");
sbool doSlack = false;
static long webSocketTimeOut = 60000;
//include #1002268 // Slack Bot
!include #1002576 // Web Serving
!include #1002578 // Eleu Core
static boolean actuallyPost = false;
static S botUserName = "";
static L actualBotUserNames = litlist();
static int webServerPort = 8080; // set to 0 for no web serving
static int httpsPort = 0; // set to 0 for no https serving
static L webSockets = synchroList();
static new AtomicLong webSocketPings;
static new AtomicLong webSocketPongs;
p {
becomeBotVMIfFirst();
webInit();
if (webServerPort != 0) pcall {
//serveHttp(webServerPort);
serveHttpWithWebsockets(webServerPort, func(NanoHTTPD.IHTTPSession handshake) {
WebSocket ws = new WebSocket(handshake) {
L msgs = synchroList();
volatile long lastMessage = sysNow();
protected void onPong(WebSocketFrame pongFrame) {
// don't use WebSocket ping/pong
}
protected void onMessage(WebSocketFrame messageFrame) {
//print("websocket msg: " + messageFrame.getTextPayload());
lastMessage = sysNow();
S s = messageFrame.getTextPayload();
msgs.add(s);
if (eq(s, "ping")) incAtomicLong(webSocketPongs);
}
protected void onClose(WebSocketFrame.CloseCode code, String reason, boolean initiatedByRemote) {
//print("websocket close");
webSockets.remove(this);
}
protected void onException(IOException e) { printStackTrace(e); }
void clean() {
if (sysNow() >= lastMessage + webSocketTimeOut) {
webSockets.remove(this);
pcall { close(WebSocketFrame.CloseCode.NormalClosure, "timeout"); }
}
}
};
webSockets.add(ws);
ret ws;
});
}
if (httpsPort != 0) pcall {
File keystore = secretProgramFile(programID(), "keystore.jks");
S pass = loadSecretTextFileMandatory("keystore-pass").trim();
serveHttps(httpsPort, keystore, pass);
}
/*if (doSlack)
initSlackBot();
dediSay("Booting...");*/
coreInit();
for (S id : seedBots)
call(getDispatcher(), "addSeedBot", id);
/*dediSay("Yo, back online!");
if (doSlack)
slackBotLoop();*/
}
static void cleanWebSockets() {
for (WebSocket ws : cloneList(webSockets)) call(ws, 'clean);
}