mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 13:45:10 +00:00
[MOD] -J and -H flags for the max XMPP/HTTP thread
This commit is contained in:
parent
61b248363d
commit
4d6ba32e98
5 changed files with 58 additions and 10 deletions
33
src/Main.c
33
src/Main.c
|
|
@ -3,12 +3,14 @@
|
|||
#include <Cytoplasm/Memory.h>
|
||||
#include <Cytoplasm/Util.h>
|
||||
#include <Cytoplasm/Cron.h>
|
||||
#include <Cytoplasm/Args.h>
|
||||
#include <Cytoplasm/Log.h>
|
||||
#include <Cytoplasm/Str.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <StringStream.h>
|
||||
#include <Parsee.h>
|
||||
|
|
@ -30,7 +32,7 @@ ParseeUptime(void)
|
|||
}
|
||||
|
||||
int
|
||||
Main(void)
|
||||
Main(Array *args, HashMap *env)
|
||||
{
|
||||
HttpServerConfig conf;
|
||||
const ParseeConfig *parsee_conf;
|
||||
|
|
@ -50,13 +52,34 @@ Main(void)
|
|||
|
||||
ParseeConfigLoad("parsee.json");
|
||||
ParseeConfigInit();
|
||||
|
||||
parsee_conf = ParseeConfigGet();
|
||||
|
||||
{
|
||||
ArgParseState state;
|
||||
int flag;
|
||||
int xmpp = 8;
|
||||
int http = 8;
|
||||
|
||||
ArgParseStateInit(&state);
|
||||
while ((flag = ArgParse(&state, args, "H:J:")) != -1)
|
||||
{
|
||||
switch (flag)
|
||||
{
|
||||
case 'H':
|
||||
http = strtol(state.optArg, NULL, 10);
|
||||
break;
|
||||
case 'J':
|
||||
xmpp = strtol(state.optArg, NULL, 10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ParseeSetThreads(xmpp, http);
|
||||
}
|
||||
/* Write out the config file to a YAML document */
|
||||
yaml = StreamOpen("parsee.yaml", "w");
|
||||
ParseeExportConfigYAML(yaml);
|
||||
StreamClose(yaml);
|
||||
|
||||
parsee_conf = ParseeConfigGet();
|
||||
{
|
||||
Log(LOG_NOTICE, "Connecting to XMPP...");
|
||||
jabber = XMPPInitialiseCompStream(
|
||||
|
|
@ -83,8 +106,8 @@ Main(void)
|
|||
ASRegisterUser(parsee_conf, parsee_conf->sender_localpart);
|
||||
|
||||
conf.port = parsee_conf->port;
|
||||
conf.threads = 4;
|
||||
conf.maxConnections = 32;
|
||||
conf.threads = parsee_conf->http_threads;
|
||||
conf.maxConnections = 32; /* TODO */
|
||||
conf.handlerArgs = ParseeInitData(jabber);
|
||||
conf.handler = ParseeRequest;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue