mirror of https://github.com/tp4a/teleport
pull/32/head
parent
22900ebf9f
commit
11567dd6f4
|
@ -49,24 +49,6 @@ bool TsEnv::init(bool load_config)
|
||||||
}
|
}
|
||||||
else // not in development mode
|
else // not in development mode
|
||||||
{
|
{
|
||||||
// #ifdef EX_OS_WIN32
|
|
||||||
// base_path = m_exec_path;
|
|
||||||
// ex_path_join(base_path, true, L"..", NULL);
|
|
||||||
// m_etc_path = base_path;
|
|
||||||
// ex_path_join(m_etc_path, false, L"etc", NULL);
|
|
||||||
// conf_file = m_etc_path;
|
|
||||||
// ex_path_join(conf_file, false, L"core.ini", NULL);
|
|
||||||
// m_replay_path = base_path;
|
|
||||||
// ex_path_join(m_replay_path, false, L"data", L"replay", NULL);
|
|
||||||
// log_path = base_path;
|
|
||||||
// ex_path_join(log_path, false, L"log", NULL);
|
|
||||||
// #else
|
|
||||||
// m_etc_path = L"/etc/teleport";
|
|
||||||
// conf_file = L"/etc/teleport/core.ini";
|
|
||||||
// m_replay_path = L"/var/lib/teleport/replay";
|
|
||||||
// log_path = L"/var/log/teleport";
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
base_path = m_exec_path;
|
base_path = m_exec_path;
|
||||||
ex_path_join(base_path, true, L"..", L"data", NULL);
|
ex_path_join(base_path, true, L"..", L"data", NULL);
|
||||||
m_etc_path = base_path;
|
m_etc_path = base_path;
|
||||||
|
@ -79,8 +61,6 @@ bool TsEnv::init(bool load_config)
|
||||||
ex_path_join(log_path, false, L"log", NULL);
|
ex_path_join(log_path, false, L"log", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//EXLOGW(L"[core] load config file: %ls.\n", conf_file.c_str());
|
|
||||||
|
|
||||||
if (!m_ini.LoadFromFile(conf_file))
|
if (!m_ini.LoadFromFile(conf_file))
|
||||||
{
|
{
|
||||||
EXLOGE(L"[core] can not load %ls.\n", conf_file.c_str());
|
EXLOGE(L"[core] can not load %ls.\n", conf_file.c_str());
|
||||||
|
|
|
@ -55,7 +55,7 @@ TsHttpRpc::~TsHttpRpc()
|
||||||
|
|
||||||
void TsHttpRpc::_thread_loop(void)
|
void TsHttpRpc::_thread_loop(void)
|
||||||
{
|
{
|
||||||
EXLOGV("[core] rpc TeleportServer-HTTP-RPC ready on %s:%d\n", m_host_ip.c_str(), m_host_port);
|
EXLOGV("[core] TeleportServer-RPC ready on %s:%d\n", m_host_ip.c_str(), m_host_port);
|
||||||
|
|
||||||
while(!m_stop_flag)
|
while(!m_stop_flag)
|
||||||
{
|
{
|
||||||
|
@ -127,7 +127,7 @@ void TsHttpRpc::_mg_event_handler(struct mg_connection *nc, int ev, void *ev_dat
|
||||||
ex_astr uri;
|
ex_astr uri;
|
||||||
uri.assign(hm->uri.p, hm->uri.len);
|
uri.assign(hm->uri.p, hm->uri.len);
|
||||||
|
|
||||||
EXLOGD("[core] rpc got request: %s\n", uri.c_str());
|
//EXLOGD("[core] rpc got request: %s\n", uri.c_str());
|
||||||
|
|
||||||
if (uri == "/rpc")
|
if (uri == "/rpc")
|
||||||
{
|
{
|
||||||
|
@ -151,9 +151,7 @@ void TsHttpRpc::_mg_event_handler(struct mg_connection *nc, int ev, void *ev_dat
|
||||||
EXLOGE("[core] rpc got invalid request: not `rpc` uri.\n");
|
EXLOGE("[core] rpc got invalid request: not `rpc` uri.\n");
|
||||||
_this->_create_json_ret(ret_buf, TSR_INVALID_REQUEST, "not a `rpc` request.");
|
_this->_create_json_ret(ret_buf, TSR_INVALID_REQUEST, "not a `rpc` request.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mg_printf(nc, "HTTP/1.0 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Length: %d\r\nContent-Type: application/json\r\n\r\n%s", (int)ret_buf.size() - 1, &ret_buf[0]);
|
mg_printf(nc, "HTTP/1.0 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Length: %d\r\nContent-Type: application/json\r\n\r\n%s", (int)ret_buf.size() - 1, &ret_buf[0]);
|
||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,5 @@ bool TppSshEnv::_on_init(TPP_INIT_ARGS* args) {
|
||||||
bind_port = TS_SSH_PROXY_PORT;
|
bind_port = TS_SSH_PROXY_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXLOGW(L"[ssh] listen on %s:%d\n", bind_ip.c_str(), bind_port);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue