aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/sledjchisl
diff options
context:
space:
mode:
Diffstat (limited to 'src/sledjchisl')
-rw-r--r--src/sledjchisl/sledjchisl.c110
1 files changed, 58 insertions, 52 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index 02b5d0c..62eb928 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -503,6 +503,7 @@ float loadAverageInc = 0.7;
503int simTimeOut = 45; 503int simTimeOut = 45;
504int bulkSims = 0; 504int bulkSims = 0;
505boolean DEBUG = FALSE; 505boolean DEBUG = FALSE;
506boolean VERBOSE = TRUE;
506qhashtbl_t *mimeTypes; 507qhashtbl_t *mimeTypes;
507qlist_t *dbRequests; 508qlist_t *dbRequests;
508 509
@@ -523,8 +524,9 @@ char *logTypes[] =
523 "93", "WARNING", // yellow 524 "93", "WARNING", // yellow
524 "36", "TIMEOUT", // cyan 525 "36", "TIMEOUT", // cyan
525 "97;40", "INFO", // white 526 "97;40", "INFO", // white
527 "92;40", "VERBOSE", // green
526 "90", "DEBUG", // grey 528 "90", "DEBUG", // grey
527// VERBOSE? UNKNOWN? FATAL? SILENT? All from Android apparently. 529// UNKNOWN? FATAL? SILENT? All from Android apparently.
528 "35", "debug", // magenta 530 "35", "debug", // magenta
529 "34", "timeout", // blue 531 "34", "timeout", // blue
530}; 532};
@@ -539,7 +541,9 @@ void logMe(int v, char *format, ...)
539 time_t curtime; 541 time_t curtime;
540 char date[DATE_TIME_LEN]; 542 char date[DATE_TIME_LEN];
541 543
542 if ((!DEBUG) && (4 < v)) 544 if ((!VERBOSE) && (4 < v))
545 return;
546 if ((!DEBUG) && (5 < v))
543 return; 547 return;
544 548
545 va_start(va, format); 549 va_start(va, format);
@@ -566,9 +570,10 @@ void logMe(int v, char *format, ...)
566#define W(...) logMe(2, __VA_ARGS__) 570#define W(...) logMe(2, __VA_ARGS__)
567#define T(...) logMe(3, __VA_ARGS__) 571#define T(...) logMe(3, __VA_ARGS__)
568#define I(...) logMe(4, __VA_ARGS__) 572#define I(...) logMe(4, __VA_ARGS__)
569#define D(...) logMe(5, __VA_ARGS__) 573#define V(...) logMe(5, __VA_ARGS__)
570#define d(...) logMe(6, __VA_ARGS__) 574#define D(...) logMe(6, __VA_ARGS__)
571#define t(...) logMe(7, __VA_ARGS__) 575#define d(...) logMe(7, __VA_ARGS__)
576#define t(...) logMe(8, __VA_ARGS__)
572 577
573 578
574static void addStrL(qlist_t *list, char *s) 579static void addStrL(qlist_t *list, char *s)
@@ -2321,7 +2326,7 @@ I("count!!!!!!!!!!!!!!!!");
2321 signed char d = (signed char) c; 2326 signed char d = (signed char) c;
2322 2327
2323 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 2328 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
2324//T("TINY %d %s %d", i, fld->name, req->inBind[i].buffer_length); 2329//V("TINY %d %s %d", i, fld->name, req->inBind[i].buffer_length);
2325 break; 2330 break;
2326 } 2331 }
2327 2332
@@ -2331,7 +2336,7 @@ I("count!!!!!!!!!!!!!!!!");
2331 short int d = (short int) c; 2336 short int d = (short int) c;
2332 2337
2333 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 2338 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
2334//T("SHORT %d %s %d = %d", i, fld->name, req->inBind[i].buffer_length, c); 2339//V("SHORT %d %s %d = %d", i, fld->name, req->inBind[i].buffer_length, c);
2335 break; 2340 break;
2336 } 2341 }
2337 2342
@@ -2340,7 +2345,7 @@ I("count!!!!!!!!!!!!!!!!");
2340 int d = va_arg(ap, int); 2345 int d = va_arg(ap, int);
2341 2346
2342 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 2347 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
2343//T("INT24 %d %s %d - %d", i, fld->name, req->inBind[i].buffer_length, d); 2348//V("INT24 %d %s %d - %d", i, fld->name, req->inBind[i].buffer_length, d);
2344 break; 2349 break;
2345 } 2350 }
2346 2351
@@ -2349,7 +2354,7 @@ I("count!!!!!!!!!!!!!!!!");
2349 long d = va_arg(ap, long); 2354 long d = va_arg(ap, long);
2350 2355
2351 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 2356 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
2352//T("LONG %d %s %d = %ld", i, fld->name, req->inBind[i].buffer_length, d); 2357//V("LONG %d %s %d = %ld", i, fld->name, req->inBind[i].buffer_length, d);
2353 break; 2358 break;
2354 } 2359 }
2355 2360
@@ -2358,7 +2363,7 @@ I("count!!!!!!!!!!!!!!!!");
2358 long long int d = va_arg(ap, long long int); 2363 long long int d = va_arg(ap, long long int);
2359 2364
2360 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 2365 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
2361//T("LONGLONG %d %s %d = %lld", i, fld->name, req->inBind[i].buffer_length, d); 2366//V("LONGLONG %d %s %d = %lld", i, fld->name, req->inBind[i].buffer_length, d);
2362 break; 2367 break;
2363 } 2368 }
2364 2369
@@ -2368,7 +2373,7 @@ I("count!!!!!!!!!!!!!!!!");
2368 float d = (float) c; 2373 float d = (float) c;
2369 2374
2370 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 2375 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
2371//T("FLOAT %d %s %d = %f", i, fld->name, req->inBind[i].buffer_length, d); 2376//V("FLOAT %d %s %d = %f", i, fld->name, req->inBind[i].buffer_length, d);
2372 break; 2377 break;
2373 } 2378 }
2374 2379
@@ -2377,13 +2382,13 @@ I("count!!!!!!!!!!!!!!!!");
2377 double d = va_arg(ap, double); 2382 double d = va_arg(ap, double);
2378 2383
2379 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 2384 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
2380//T("DOUBLE %d %s %d = %f", i, fld->name, req->inBind[i].buffer_length, d); 2385//V("DOUBLE %d %s %d = %f", i, fld->name, req->inBind[i].buffer_length, d);
2381 break; 2386 break;
2382 } 2387 }
2383 2388
2384 case MYSQL_TYPE_NEWDECIMAL: 2389 case MYSQL_TYPE_NEWDECIMAL:
2385 { 2390 {
2386//T("NEWDECIMAL %d %s %d", i, fld->name, req->inBind[i].buffer_length); 2391//V("NEWDECIMAL %d %s %d", i, fld->name, req->inBind[i].buffer_length);
2387 break; 2392 break;
2388 } 2393 }
2389 2394
@@ -2395,7 +2400,7 @@ I("count!!!!!!!!!!!!!!!!");
2395 MYSQL_TIME d = va_arg(ap, MYSQL_TIME); 2400 MYSQL_TIME d = va_arg(ap, MYSQL_TIME);
2396 2401
2397 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length); 2402 memcpy(req->inBind[i].buffer, &d, (size_t) fld->length);
2398//T("DATE / TIME ish %d %s %d", i, fld->name, req->inBind[i].buffer_length); 2403//V("DATE / TIME ish %d %s %d", i, fld->name, req->inBind[i].buffer_length);
2399 break; 2404 break;
2400 } 2405 }
2401 2406
@@ -2410,7 +2415,7 @@ I("count!!!!!!!!!!!!!!!!");
2410 *(req->inBind[i].length) = l; 2415 *(req->inBind[i].length) = l;
2411 strncpy(req->inBind[i].buffer, d, (size_t) l); 2416 strncpy(req->inBind[i].buffer, d, (size_t) l);
2412 ((char *) req->inBind[i].buffer)[l] = '\0'; 2417 ((char *) req->inBind[i].buffer)[l] = '\0';
2413//T("STRING / VARSTRING %d %s %d = %s", i, fld->name, req->inBind[i].buffer_length, d); 2418//V("STRING / VARSTRING %d %s %d = %s", i, fld->name, req->inBind[i].buffer_length, d);
2414 break; 2419 break;
2415 } 2420 }
2416 2421
@@ -2420,19 +2425,19 @@ I("count!!!!!!!!!!!!!!!!");
2420 case MYSQL_TYPE_LONG_BLOB: 2425 case MYSQL_TYPE_LONG_BLOB:
2421 { 2426 {
2422// TODO - should write this, we will likely need it. Main problem is - how long is this blob? Probably should add a length param before the blob. 2427// TODO - should write this, we will likely need it. Main problem is - how long is this blob? Probably should add a length param before the blob.
2423//T("BLOBs %d %s %d", i, fld->name, req->inBind[i].buffer_length); 2428//V("BLOBs %d %s %d", i, fld->name, req->inBind[i].buffer_length);
2424 break; 2429 break;
2425 } 2430 }
2426 2431
2427 case MYSQL_TYPE_BIT: 2432 case MYSQL_TYPE_BIT:
2428 { 2433 {
2429//T("BIT %d %s %d", i, fld->name, req->inBind[i].buffer_length); 2434//V("BIT %d %s %d", i, fld->name, req->inBind[i].buffer_length);
2430 break; 2435 break;
2431 } 2436 }
2432 2437
2433 case MYSQL_TYPE_NULL: 2438 case MYSQL_TYPE_NULL:
2434 { 2439 {
2435//T("NULL %d %s %d", i, fld->name, req->inBind[i].buffer_length); 2440//V("NULL %d %s %d", i, fld->name, req->inBind[i].buffer_length);
2436 break; 2441 break;
2437 } 2442 }
2438 } 2443 }
@@ -5731,7 +5736,7 @@ d("accountRead() UUID %s, name %s %s", uuid, first, last);
5731 5736
5732 if (0 == rt) 5737 if (0 == rt)
5733 { 5738 {
5734T("Found Lua record."); 5739V("Found Lua record.");
5735 ret += 1; 5740 ret += 1;
5736 Rd->database->putstr(Rd->database, "UserAccounts.FirstName", first); 5741 Rd->database->putstr(Rd->database, "UserAccounts.FirstName", first);
5737 Rd->database->putstr(Rd->database, "UserAccounts.LastName", last); 5742 Rd->database->putstr(Rd->database, "UserAccounts.LastName", last);
@@ -5761,7 +5766,7 @@ T("Found Lua record.");
5761 if (1 == rt) 5766 if (1 == rt)
5762 { 5767 {
5763 ret = rt; 5768 ret = rt;
5764T("Found database record."); 5769V("Found database record.");
5765 dbPull(Rd, "UserAccounts", rows); 5770 dbPull(Rd, "UserAccounts", rows);
5766 5771
5767 char *name = xmprintf("%s %s", getStrH(Rd->database, "UserAccounts.FirstName"), getStrH(Rd->database, "UserAccounts.LastName")); 5772 char *name = xmprintf("%s %s", getStrH(Rd->database, "UserAccounts.FirstName"), getStrH(Rd->database, "UserAccounts.LastName"));
@@ -6933,20 +6938,21 @@ void sledjchisl_main(void)
6933 int status, result, i; 6938 int status, result, i;
6934 void *vd; 6939 void *vd;
6935 6940
6941 V("SledjChisl arguments - %d %d", toys.optc, toys.optflags);
6942 for (i = 0; i < toys.optc; i++)
6943 V(" argument %d %s", i, toys.optargs[i] );
6944
6936 configs = qhashtbl(0, 0); 6945 configs = qhashtbl(0, 0);
6937 L = luaL_newstate(); 6946 L = luaL_newstate();
6938 6947
6939 I("libfcgi version: %s", FCGI_VERSION); 6948 V("libfcgi version: %s", FCGI_VERSION);
6940 I("Lua version: %s", LUA_RELEASE); 6949 V("Lua version: %s", LUA_RELEASE);
6941 I("LuaJIT version: %s", LUAJIT_VERSION); 6950 V("LuaJIT version: %s", LUAJIT_VERSION);
6942 I("MariaDB / MySQL client version: %s", mysql_get_client_info()); 6951 V("MariaDB / MySQL client version: %s", mysql_get_client_info());
6943 I("OpenSSL version: %s", OPENSSL_VERSION_TEXT); 6952 V("OpenSSL version: %s", OPENSSL_VERSION_TEXT);
6944 I("qLibc version: qLibc only git tags for version numbers. Sooo, 2.4.4, unless I forgot to update this."); 6953 V("qLibc version: qLibc only git tags for version numbers. Sooo, 2.4.4, unless I forgot to update this.");
6945 I("toybox version: %s", TOYBOX_VERSION); 6954 V("toybox version: %s", TOYBOX_VERSION);
6946 6955
6947 t("SledjChisl arguments %d %d", (int)toys.optflags, (int)toys.optc);
6948 for (i = 0; i < toys.optc; i++)
6949 T(" argument %d %s", i, toys.optargs[i] );
6950 6956
6951 dbRequests = qlist(0); 6957 dbRequests = qlist(0);
6952 sigatexit(cleanup); 6958 sigatexit(cleanup);
@@ -7074,24 +7080,24 @@ jit library is loaded or the JIT compiler will not be activated.
7074 } 7080 }
7075 } 7081 }
7076 DEBUG = configs->getint(configs, "debug"); 7082 DEBUG = configs->getint(configs, "debug");
7077 I("Setting DEBUG = %d", DEBUG); 7083 V("Setting DEBUG = %d", DEBUG);
7078 if ((vd = configs->get (configs, "loadAverageInc", NULL, false)) != NULL) {loadAverageInc = *((float *) vd); T("Setting loadAverageInc = %f", loadAverageInc);} 7084 if ((vd = configs->get (configs, "loadAverageInc", NULL, false)) != NULL) {loadAverageInc = *((float *) vd); V("Setting loadAverageInc = %f", loadAverageInc);}
7079 if ((vd = configs->get (configs, "simTimeOut", NULL, false)) != NULL) {simTimeOut = (int) *((float *) vd); T("Setting simTimeOut = %d", simTimeOut);} 7085 if ((vd = configs->get (configs, "simTimeOut", NULL, false)) != NULL) {simTimeOut = (int) *((float *) vd); V("Setting simTimeOut = %d", simTimeOut);}
7080 if ((vd = configs->get (configs, "bulkSims", NULL, false)) != NULL) {bulkSims = (int) *((float *) vd); T("Setting bulkSims = %d", bulkSims);} 7086 if ((vd = configs->get (configs, "bulkSims", NULL, false)) != NULL) {bulkSims = (int) *((float *) vd); V("Setting bulkSims = %d", bulkSims);}
7081 if ((tmp = configs->getstr(configs, "scRoot", false)) != NULL) {scRoot = tmp; T("Setting scRoot = %s", scRoot);} 7087 if ((tmp = configs->getstr(configs, "scRoot", false)) != NULL) {scRoot = tmp; V("Setting scRoot = %s", scRoot);}
7082 if ((tmp = configs->getstr(configs, "scUser", false)) != NULL) {scUser = tmp; T("Setting scUser = %s", scUser);} 7088 if ((tmp = configs->getstr(configs, "scUser", false)) != NULL) {scUser = tmp; V("Setting scUser = %s", scUser);}
7083 if ((tmp = configs->getstr(configs, "Tconsole", false)) != NULL) {Tconsole = tmp; T("Setting Tconsole = %s", Tconsole);} 7089 if ((tmp = configs->getstr(configs, "Tconsole", false)) != NULL) {Tconsole = tmp; V("Setting Tconsole = %s", Tconsole);}
7084 if ((tmp = configs->getstr(configs, "Tsocket", false)) != NULL) {Tsocket = tmp; T("Setting Tsocket = %s", Tsocket);} 7090 if ((tmp = configs->getstr(configs, "Tsocket", false)) != NULL) {Tsocket = tmp; V("Setting Tsocket = %s", Tsocket);}
7085 if ((tmp = configs->getstr(configs, "Ttab", false)) != NULL) {Ttab = tmp; T("Setting Ttab = %s", Ttab);} 7091 if ((tmp = configs->getstr(configs, "Ttab", false)) != NULL) {Ttab = tmp; V("Setting Ttab = %s", Ttab);}
7086 if ((tmp = configs->getstr(configs, "backupIARsim", false)) != NULL) {backupIARsim = tmp; T("Setting backupIARsim = %s", backupIARsim);} 7092 if ((tmp = configs->getstr(configs, "backupIARsim", false)) != NULL) {backupIARsim = tmp; V("Setting backupIARsim = %s", backupIARsim);}
7087 if ((tmp = configs->getstr(configs, "webRoot", false)) != NULL) {webRoot = tmp; T("Setting webRoot = %s", webRoot);} 7093 if ((tmp = configs->getstr(configs, "webRoot", false)) != NULL) {webRoot = tmp; V("Setting webRoot = %s", webRoot);}
7088 if ((tmp = configs->getstr(configs, "URL", false)) != NULL) {URL = tmp; T("Setting URL = %s", URL);} 7094 if ((tmp = configs->getstr(configs, "URL", false)) != NULL) {URL = tmp; V("Setting URL = %s", URL);}
7089 if ((vd = configs->get (configs, "seshRenew", NULL, false)) != NULL) {seshRenew = (int) *((float *) vd); T("Setting seshRenew = %d", seshRenew);} 7095 if ((vd = configs->get (configs, "seshRenew", NULL, false)) != NULL) {seshRenew = (int) *((float *) vd); V("Setting seshRenew = %d", seshRenew);}
7090 if ((vd = configs->get (configs, "idleTimeOut", NULL, false)) != NULL) {idleTimeOut = (int) *((float *) vd); T("Setting idleTimeOut = %d", idleTimeOut);} 7096 if ((vd = configs->get (configs, "idleTimeOut", NULL, false)) != NULL) {idleTimeOut = (int) *((float *) vd); V("Setting idleTimeOut = %d", idleTimeOut);}
7091 if ((vd = configs->get (configs, "seshTimeOut", NULL, false)) != NULL) {seshTimeOut = (int) *((float *) vd); T("Setting seshTimeOut = %d", seshTimeOut);} 7097 if ((vd = configs->get (configs, "seshTimeOut", NULL, false)) != NULL) {seshTimeOut = (int) *((float *) vd); V("Setting seshTimeOut = %d", seshTimeOut);}
7092 if ((vd = configs->get (configs, "newbieTimeOut", NULL, false)) != NULL) {newbieTimeOut = (int) *((float *) vd); T("Setting newbieTimeOut = %d", newbieTimeOut);} 7098 if ((vd = configs->get (configs, "newbieTimeOut", NULL, false)) != NULL) {newbieTimeOut = (int) *((float *) vd); V("Setting newbieTimeOut = %d", newbieTimeOut);}
7093 if ((tmp = configs->getstr(configs, "ToS", false)) != NULL) {ToS = tmp; T("Setting ToS = %s", ToS);} 7099 if ((tmp = configs->getstr(configs, "ToS", false)) != NULL) {ToS = tmp; V("Setting ToS = %s", ToS);}
7094 if ((tmp = configs->getstr(configs, "webIframers", false)) != NULL) {webIframers = tmp; T("Setting webIframers = %s", webIframers);} 7100 if ((tmp = configs->getstr(configs, "webIframers", false)) != NULL) {webIframers = tmp; V("Setting webIframers = %s", webIframers);}
7095 7101
7096 7102
7097//////////////////////////////////////////////////////////////////////////////////////////////////// 7103////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -7213,7 +7219,7 @@ jit library is loaded or the JIT compiler will not be activated.
7213 // toybox argument parsing is half working. 7219 // toybox argument parsing is half working.
7214 if ((NULL == toys.optargs[0]) || (('-' != toys.optargs[0][0]) && ('q' != toys.optargs[0][1]))) 7220 if ((NULL == toys.optargs[0]) || (('-' != toys.optargs[0][0]) && ('q' != toys.optargs[0][1])))
7215 { 7221 {
7216 T("Joining the session."); 7222 V("Joining the session.");
7217 // Join the session. 7223 // Join the session.
7218 memset(toybuf, 0, sizeof(toybuf)); 7224 memset(toybuf, 0, sizeof(toybuf));
7219 snprintf(toybuf, sizeof(toybuf), "%s %s/%s select-window -t '%s' \\; attach-session -t '%s'", Tcmd, scRun, Tsocket, Tconsole, Tconsole); 7225 snprintf(toybuf, sizeof(toybuf), "%s %s/%s select-window -t '%s' \\; attach-session -t '%s'", Tcmd, scRun, Tsocket, Tconsole, Tconsole);
@@ -7222,7 +7228,7 @@ jit library is loaded or the JIT compiler will not be activated.
7222 E("tmux attach-session command failed! %s", toybuf); 7228 E("tmux attach-session command failed! %s", toybuf);
7223 } 7229 }
7224 else 7230 else
7225 T("NOT joining the session."); 7231 V("NOT joining the session.");
7226 goto finished; 7232 goto finished;
7227 } 7233 }
7228 } 7234 }
@@ -7843,7 +7849,7 @@ fcgiDone:
7843 window++; 7849 window++;
7844 } 7850 }
7845 7851
7846 T("Prepping sims of type %s, window %d, %d panes per window.", type, window, panes); 7852 V("Prepping sims of type %s, window %d, %d panes per window.", type, window, panes);
7847 7853
7848 memset((void*)&obj1, 0, sizeof(obj1)); 7854 memset((void*)&obj1, 0, sizeof(obj1));
7849 q0->v.t->lock(q0->v.t); 7855 q0->v.t->lock(q0->v.t);
@@ -8059,7 +8065,7 @@ fcgiDone:
8059 window++; 8065 window++;
8060 } 8066 }
8061 8067
8062 T("Doing sims of type %s, window %d, %d panes per window.", type, window, panes); 8068 V("Doing sims of type %s, window %d, %d panes per window.", type, window, panes);
8063 memset((void*)&obj1, 0, sizeof(obj1)); 8069 memset((void*)&obj1, 0, sizeof(obj1));
8064 q0->v.t->lock(q0->v.t); 8070 q0->v.t->lock(q0->v.t);
8065 while(q0->v.t->getnext(q0->v.t, &obj1, false) == true) 8071 while(q0->v.t->getnext(q0->v.t, &obj1, false) == true)