mirror of https://github.com/tp4a/teleport
.temp.
parent
a43f7b0f35
commit
7b0cc6f33d
|
@ -72,7 +72,7 @@ bool ExThreadBase::stop(void) {
|
|||
m_need_stop = true;
|
||||
_on_stop();
|
||||
|
||||
EXLOGV("[thread] wait thread [%s] exit.\n", m_thread_name.c_str());
|
||||
EXLOGV("[thread] wait thread [%s] exit, thread-handle=0x%08x.\n", m_thread_name.c_str(), m_handle);
|
||||
|
||||
#ifdef EX_OS_WIN32
|
||||
if (m_handle) {
|
||||
|
|
|
@ -382,6 +382,7 @@ void TsHttpRpc::_rpc_func_request_session(const Json::Value& json_param, ex_astr
|
|||
if ((rv = ts_web_rpc_get_conn_info(conn_id, *info)) != TPE_OK)
|
||||
{
|
||||
_create_json_ret(buf, rv);
|
||||
delete info;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -392,6 +393,7 @@ void TsHttpRpc::_rpc_func_request_session(const Json::Value& json_param, ex_astr
|
|||
ex_astr sid;
|
||||
if (!g_session_mgr.request_session(sid, info)) {
|
||||
_create_json_ret(buf, TPE_FAILED);
|
||||
delete info;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "ts_session.h"
|
||||
#include "ts_session.h"
|
||||
#include "ts_env.h"
|
||||
|
||||
#include <mbedtls/sha1.h>
|
||||
|
@ -13,6 +13,7 @@ TsSessionManager::TsSessionManager() :
|
|||
TsSessionManager::~TsSessionManager() {
|
||||
ts_connections::iterator it_conn = m_connections.begin();
|
||||
for (; it_conn != m_connections.end(); ++it_conn) {
|
||||
EXLOGD("[core] m_connections not clean: %s, %s\n", it_conn->first.c_str(), it_conn->second->acc_username.c_str());
|
||||
delete it_conn->second;
|
||||
}
|
||||
m_connections.clear();
|
||||
|
@ -28,7 +29,7 @@ void TsSessionManager::_thread_loop(void) {
|
|||
}
|
||||
|
||||
void TsSessionManager::_remove_expired_connect_info(void) {
|
||||
// 超过15秒未进行连接的connect-info会被移除
|
||||
// 超过15秒未进行连接的connect-info会被移除
|
||||
|
||||
ExThreadSmartLock locker(m_lock);
|
||||
|
||||
|
@ -87,8 +88,8 @@ bool TsSessionManager::free_connect_info(const ex_astr &sid) {
|
|||
|
||||
it->second->ref_count--;
|
||||
|
||||
// 对于RDP来说,此时不要移除连接信息,系统自带RDP客户端在第一次连接时进行协议协商,然后马上会断开,之后立即重新连接一次(第二次连接之前可能会提示证书信息,如果用户长时间不操作,可能会导致超时)。
|
||||
// 因此,我们将其引用计数减低,并更新一下最后访问时间,让定时器来移除它。
|
||||
// 对于RDP来说,此时不要移除连接信息,系统自带RDP客户端在第一次连接时进行协议协商,然后马上会断开,之后立即重新连接一次(第二次连接之前可能会提示证书信息,如果用户长时间不操作,可能会导致超时)。
|
||||
// 因此,我们将其引用计数减低,并更新一下最后访问时间,让定时器来移除它。
|
||||
if (it->second->protocol_type != TP_PROTOCOL_TYPE_RDP) {
|
||||
if (it->second->ref_count <= 0) {
|
||||
EXLOGD("[core] remove connection info, because all connections closed: %s\n", it->first.c_str());
|
||||
|
@ -99,7 +100,7 @@ bool TsSessionManager::free_connect_info(const ex_astr &sid) {
|
|||
} else {
|
||||
if (it->second->ref_count == 1)
|
||||
it->second->ref_count = 0;
|
||||
it->second->ticket_start = ex_get_tick_count() + 45000; // 我们将时间向后移动45秒,这样如果没有发生RDP的第二次连接,这个连接信息就会在一分钟后被清除。
|
||||
it->second->ticket_start = ex_get_tick_count() + 45000; // 我们将时间向后移动45秒,这样如果没有发生RDP的第二次连接,这个连接信息就会在一分钟后被清除。
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,7 +134,7 @@ bool TsSessionManager::request_session(ex_astr &sid, TS_CONNECT_INFO *info) {
|
|||
|
||||
sid = _sid;
|
||||
if (info->protocol_type == TP_PROTOCOL_TYPE_RDP) {
|
||||
info->ref_count = 1; // 因为RDP连接之前可能会有很长时间用于确认是否连接、是否信任证书,所以很容易超时,我们认为将引用计数+1,防止因超时被清除。
|
||||
info->ref_count = 1; // 因为RDP连接之前可能会有很长时间用于确认是否连接、是否信任证书,所以很容易超时,我们认为将引用计数+1,防止因超时被清除。
|
||||
char szTmp[8] = {0};
|
||||
snprintf(szTmp, 8, "%02X", (unsigned char) (info->acc_username.length() + info->acc_secret.length()));
|
||||
sid += szTmp;
|
||||
|
|
Loading…
Reference in New Issue