removed MAIN*CHROOT from the sample app code
This commit is contained in:
parent
a3aba8bf44
commit
d97cb915c5
@ -151,7 +151,8 @@ int qse_mbsntonwad (const qse_mchar_t* str, qse_size_t len, qse_nwad_t* nwad)
|
|||||||
|
|
||||||
if (p >= end) return -1;
|
if (p >= end) return -1;
|
||||||
|
|
||||||
if ((*p == '@' && len >= 2) || *p == '/') // with @, you can specify a relative path
|
// with @, you can specify a relative path as well as an absolute path
|
||||||
|
if ((*p == '@' && len >= 2) || *p == '/')
|
||||||
{
|
{
|
||||||
/* the string begins with @. it's a local name excluding @.
|
/* the string begins with @. it's a local name excluding @.
|
||||||
* if it begins with /, it's also a local name */
|
* if it begins with /, it's also a local name */
|
||||||
|
@ -18,11 +18,6 @@ MainApp::Env::Env (MainApp* app, QSE::Mmgr* mmgr): SkvEnv(mmgr), app(app), log_t
|
|||||||
QSE_T("info+"),
|
QSE_T("info+"),
|
||||||
(ProbeProc)&MainApp::Env::probe_log_level);
|
(ProbeProc)&MainApp::Env::probe_log_level);
|
||||||
|
|
||||||
this->addItem (
|
|
||||||
APP_ENV_CHROOT,
|
|
||||||
QSE_T(""),
|
|
||||||
(ProbeProc)&MainApp::Env::probe_chroot);
|
|
||||||
|
|
||||||
this->addItem (
|
this->addItem (
|
||||||
APP_ENV_GATE_ADDRESSES,
|
APP_ENV_GATE_ADDRESSES,
|
||||||
APP_GATE_ADDRESSES,
|
APP_GATE_ADDRESSES,
|
||||||
@ -76,14 +71,6 @@ int MainApp::Env::probe_log_level (const qse_char_t* v)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MainApp::Env::probe_chroot (const qse_char_t* v)
|
|
||||||
{
|
|
||||||
// nothing to inspect
|
|
||||||
if (v[0] != '\0' && qse_stristype(v, QSE_CTYPE_SPACE)) return -1;
|
|
||||||
this->chroot.update (v);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MainApp::Env::probe_gate_addresses (const qse_char_t* v)
|
int MainApp::Env::probe_gate_addresses (const qse_char_t* v)
|
||||||
{
|
{
|
||||||
if (v[0] == '\0' || qse_stristype(v, QSE_CTYPE_SPACE)) return -1;
|
if (v[0] == '\0' || qse_stristype(v, QSE_CTYPE_SPACE)) return -1;
|
||||||
@ -155,6 +142,8 @@ int MainApp::run (bool foreground)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
this->chroot_if_needed ();
|
||||||
|
|
||||||
int x = this->load_config();
|
int x = this->load_config();
|
||||||
|
|
||||||
QSE_APP_LOG1 (this, QSE_LOG_INFO, QSE_T("starting application %d\n"), (int)getpid());
|
QSE_APP_LOG1 (this, QSE_LOG_INFO, QSE_T("starting application %d\n"), (int)getpid());
|
||||||
@ -162,8 +151,6 @@ int MainApp::run (bool foreground)
|
|||||||
if (x <= -1) QSE_APP_LOG1 (this, QSE_LOG_WARNING, QSE_T("unable to load configuration from %js\n"), this->conffile.getData());
|
if (x <= -1) QSE_APP_LOG1 (this, QSE_LOG_WARNING, QSE_T("unable to load configuration from %js\n"), this->conffile.getData());
|
||||||
else QSE_APP_LOG1 (this, QSE_LOG_INFO, QSE_T("loaded configuration from %js\n"), this->conffile.getData());
|
else QSE_APP_LOG1 (this, QSE_LOG_INFO, QSE_T("loaded configuration from %js\n"), this->conffile.getData());
|
||||||
|
|
||||||
this->chroot_if_needed ();
|
|
||||||
|
|
||||||
this->tcp_gate.setBindAddress (this->gate_addresses.isEmpty()? this->env.getGateAddresses(): this->gate_addresses.getData());
|
this->tcp_gate.setBindAddress (this->gate_addresses.isEmpty()? this->env.getGateAddresses(): this->gate_addresses.getData());
|
||||||
if (this->tcp_gate.start() <= -1)
|
if (this->tcp_gate.start() <= -1)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
|
|
||||||
#define APP_ENV_LOG_TYPE QSE_T("MAIN*LOG_TYPE")
|
#define APP_ENV_LOG_TYPE QSE_T("MAIN*LOG_TYPE")
|
||||||
#define APP_ENV_LOG_LEVEL QSE_T("MAIN*LOG_LEVEL")
|
#define APP_ENV_LOG_LEVEL QSE_T("MAIN*LOG_LEVEL")
|
||||||
#define APP_ENV_CHROOT QSE_T("MAIN*CHROOT")
|
|
||||||
|
|
||||||
#define APP_ENV_GATE_ADDRESSES QSE_T("GATE*ADDRESSES")
|
#define APP_ENV_GATE_ADDRESSES QSE_T("GATE*ADDRESSES")
|
||||||
#define APP_ENV_GATE_MAX_CONNECTIONS QSE_T("GATE*MAX_CONNECTIONS")
|
#define APP_ENV_GATE_MAX_CONNECTIONS QSE_T("GATE*MAX_CONNECTIONS")
|
||||||
@ -76,7 +75,6 @@ public:
|
|||||||
|
|
||||||
int probe_log_type (const qse_char_t* v);
|
int probe_log_type (const qse_char_t* v);
|
||||||
int probe_log_level (const qse_char_t* v);
|
int probe_log_level (const qse_char_t* v);
|
||||||
int probe_chroot (const char_t* v);
|
|
||||||
|
|
||||||
int probe_gate_addresses (const qse_char_t* v);
|
int probe_gate_addresses (const qse_char_t* v);
|
||||||
int probe_gate_max_connections (const qse_char_t* v);
|
int probe_gate_max_connections (const qse_char_t* v);
|
||||||
|
Loading…
Reference in New Issue
Block a user