#10 问题仍然存在,暂时屏蔽可能导致此问题的代码,再进行测试。

pull/32/head
Apex Liu 2017-04-17 17:40:17 +08:00
parent 1db6a66ba1
commit e2e0097a4a
5 changed files with 355 additions and 288 deletions

View File

@ -61,6 +61,9 @@ def main():
if x == 'c':
clean_all()
continue
elif x == 'a':
clean_everything()
continue
try:
x = int(x)
@ -90,8 +93,20 @@ def main():
def clean_all():
cc.e('sorry, clean not implemented yet.')
# utils.remove(os.path.join(env.root_path, 'out'))
# cc.e('sorry, clean not implemented yet.')
utils.remove(os.path.join(env.root_path, 'out'))
def clean_everything():
utils.remove(os.path.join(env.root_path, 'out'))
utils.remove(os.path.join(env.root_path, 'external', 'jsoncpp'))
utils.remove(os.path.join(env.root_path, 'external', 'libuv'))
utils.remove(os.path.join(env.root_path, 'external', 'mbedtls'))
utils.remove(os.path.join(env.root_path, 'external', 'mongoose'))
utils.remove(os.path.join(env.root_path, 'external', 'openssl'))
utils.remove(os.path.join(env.root_path, 'external', 'python'))
utils.remove(os.path.join(env.root_path, 'external', 'libssh-win-static', 'lib'))
utils.remove(os.path.join(env.root_path, 'external', 'libssh-win-static', 'src'))
def do_opt(opt):
@ -210,7 +225,7 @@ def get_input(msg, log_func=cc.w):
def show_logo():
cc.v('[]=======================================================[]')
cc.o((cc.CR_VERBOSE, ' | '), (cc.CR_INFO, 'Teleport Projects Builder'), (cc.CR_VERBOSE, ' |'))
cc.v(' | auth: apexliu@eomsoft.net |')
cc.v(' | auth: apex.liu@qq.com |')
cc.v('[]=======================================================[]')
@ -224,7 +239,8 @@ def show_menu():
cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, '%2d' % options[o]['id']), (cc.CR_NORMAL, '] ', options[o]['disp']))
cc.v(' -------------------------------------------------------')
cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' C'), (cc.CR_NORMAL, '] clean build and dist env.'))
cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' C'), (cc.CR_NORMAL, '] clean build and dist.'))
cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' A'), (cc.CR_NORMAL, '] clean everything.'))
cc.v(' -------------------------------------------------------')
cc.o((cc.CR_NORMAL, ' ['), (cc.CR_INFO, ' Q'), (cc.CR_NORMAL, '] exit'))

View File

@ -63,6 +63,9 @@ class Env(object):
if not self._load_config(warn_miss_tool):
return False
if not self._load_version():
return False
return True
def _load_config(self, warn_miss_tool):
@ -73,24 +76,8 @@ class Env(object):
_cfg = configparser.ConfigParser()
_cfg.read(_cfg_file)
if 'external_ver' not in _cfg.sections() or 'toolchain' not in _cfg.sections():
cc.e('invalid configuration file: need `external_ver` and `toolchain` section.')
return False
_tmp = _cfg['external_ver']
try:
_v_openssl = _tmp['openssl'].split(',')
self.ver_openssl = _v_openssl[0].strip()
self.ver_openssl_number = _v_openssl[1].strip()
self.ver_libuv = _tmp['libuv']
self.ver_mbedtls = _tmp['mbedtls']
self.ver_sqlite = _tmp['sqlite']
self.ver_libssh = _tmp['libssh']
self.ver_jsoncpp = _tmp['jsoncpp']
self.ver_mongoose = _tmp['mongoose']
except KeyError:
cc.e('invalid configuration file: not all necessary external version are set.')
if 'toolchain' not in _cfg.sections():
cc.e('invalid configuration file: need `toolchain` section.')
return False
_tmp = _cfg['toolchain']
@ -120,6 +107,9 @@ class Env(object):
if self.nasm is None or not os.path.exists(self.nasm):
if warn_miss_tool:
cc.w(' - can not locate `nasm`, so I can build openssl.')
else:
_nasm_path = os.path.abspath(os.path.join(self.nasm, '..'))
os.environ['path'] = os.environ['path'] + ';' + _nasm_path
if 'perl' in _tmp:
self.perl = _tmp['perl']
@ -165,6 +155,36 @@ class Env(object):
return True
def _load_version(self):
_ver_file = os.path.join(self.root_path, 'external', 'version.ini')
if not os.path.exists(_ver_file):
cc.e('can not load version configuration for external.')
return False
_cfg = configparser.ConfigParser()
_cfg.read(_ver_file)
if 'external_ver' not in _cfg.sections():
cc.e('invalid configuration file: need `external_ver` section.')
return False
_tmp = _cfg['external_ver']
try:
_v_openssl = _tmp['openssl'].split(',')
self.ver_openssl = _v_openssl[0].strip()
self.ver_openssl_number = _v_openssl[1].strip()
self.ver_libuv = _tmp['libuv']
self.ver_mbedtls = _tmp['mbedtls']
self.ver_sqlite = _tmp['sqlite']
self.ver_libssh = _tmp['libssh']
self.ver_jsoncpp = _tmp['jsoncpp']
self.ver_mongoose = _tmp['mongoose']
except KeyError:
cc.e('invalid configuration file: not all necessary external version are set.')
return False
return True
def _get_msbuild(self):
# 14.0 = VS2015
# 12.0 = VS2012

View File

@ -29,14 +29,3 @@ wget = C:\Program Files (x86)\wget\wget.exe
# if not set cmake path, default to '/usr/bin/cmake'
cmake = /opt/cmake/bin/cmake
[external_ver]
openssl = 1.0.2h,1000208f
libuv = 1.11.0
mbedtls = 2.3.0
sqlite = 3170000
libssh = 0.7.4
jsoncpp = 0.10.6
mongoose = 6.6

42
external/version.ini vendored Normal file
View File

@ -0,0 +1,42 @@
[toolchain]
#============================================
# for windows
#============================================
# Need wget to download necessary dependency files.
wget = C:\Program Files (x86)\wget\wget.exe
# Need 7z to unzip downloaded files.
7z = C:\Program Files (x86)\7zip\7z.exe
# need perl to build openssl on Windows, if not set, default to get it from register.
# suggest install ActivePerl.
#perl = C:\Perl\bin\perl.exe
# need nasm to build openssl on Windows, if not set, default to locate it from register.
#nasm = C:\Users\username\AppData\Local\NASM\nasm.exe
# if not set nsis path, default to get it by register.
#nsis = C:\Program Files (x86)\NSIS\Unicode\makensis.exe
# if not set msbuild path, default to get it by register.
#msbuild = C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe
# ============================================
# for linux
# ============================================
# if not set cmake path, default to '/usr/bin/cmake'
cmake = /opt/cmake/bin/cmake
[external_ver]
openssl = 1.0.2h,1000208f
libuv = 1.11.0
mbedtls = 2.3.0
sqlite = 3170000
libssh = 0.7.4
jsoncpp = 0.10.6
mongoose = 6.6

View File

@ -965,55 +965,55 @@ int SshSession::_on_server_channel_data(ssh_session session, ssh_channel channel
}
else
{
if (len > 5 && len < 256)
{
const ex_u8* _begin = ex_memmem((const ex_u8*)data, len, (const ex_u8*)"\033]0;", 4);
if (NULL != _begin)
{
size_t len_before = _begin - (const ex_u8*)data;
const ex_u8* _end = ex_memmem(_begin + 4, len - len_before, (const ex_u8*)"\007", 1);
if (NULL != _end)
{
_end++;
// 这个包中含有改变标题的数据,将标题换为我们想要的
size_t len_end = len - (_end - (const ex_u8*)data);
MemBuffer mbuf;
if (len_before > 0)
mbuf.append((ex_u8*)data, len_before);
mbuf.append((ex_u8*)"\033]0;tpssh://", 13);
mbuf.append((ex_u8*)_this->m_server_ip.c_str(), _this->m_server_ip.length());
mbuf.append((ex_u8*)"\007", 1);
if (len_end > 0)
mbuf.append((ex_u8*)_end, len_end);
if(mbuf.size() > 0)
{
ret = ssh_channel_write(info->channel, mbuf.data(), mbuf.size());
if (ret <= 0)
EXLOGE("[ssh] send to client failed (1).\n");
else
ret = len;
}
else
{
ret = ssh_channel_write(info->channel, data, len);
}
}
else
{
ret = ssh_channel_write(info->channel, data, len);
}
}
else
{
ret = ssh_channel_write(info->channel, data, len);
}
}
else
// if (len > 5 && len < 256)
// {
// const ex_u8* _begin = ex_memmem((const ex_u8*)data, len, (const ex_u8*)"\033]0;", 4);
// if (NULL != _begin)
// {
// size_t len_before = _begin - (const ex_u8*)data;
// const ex_u8* _end = ex_memmem(_begin + 4, len - len_before, (const ex_u8*)"\007", 1);
// if (NULL != _end)
// {
// _end++;
//
// // 这个包中含有改变标题的数据,将标题换为我们想要的
// size_t len_end = len - (_end - (const ex_u8*)data);
// MemBuffer mbuf;
//
// if (len_before > 0)
// mbuf.append((ex_u8*)data, len_before);
//
// mbuf.append((ex_u8*)"\033]0;tpssh://", 13);
// mbuf.append((ex_u8*)_this->m_server_ip.c_str(), _this->m_server_ip.length());
// mbuf.append((ex_u8*)"\007", 1);
//
// if (len_end > 0)
// mbuf.append((ex_u8*)_end, len_end);
//
// if(mbuf.size() > 0)
// {
// ret = ssh_channel_write(info->channel, mbuf.data(), mbuf.size());
// if (ret <= 0)
// EXLOGE("[ssh] send to client failed (1).\n");
// else
// ret = len;
// }
// else
// {
// ret = ssh_channel_write(info->channel, data, len);
// }
// }
// else
// {
// ret = ssh_channel_write(info->channel, data, len);
// }
// }
// else
// {
// ret = ssh_channel_write(info->channel, data, len);
// }
// }
// else
{
ret = ssh_channel_write(info->channel, data, len);
}