|
@@ -200,8 +200,8 @@ SpEntity::SpEntity(SpModule *pModule, sp_entity_t *ent, sp_cfg_shell_entity_t *c
|
|
|
|
|
|
SpEntity::~SpEntity()
|
|
|
{
|
|
|
-#ifdef _WIN32
|
|
|
Dbg("run ~SpEntity()");
|
|
|
+#ifdef _WIN32
|
|
|
getEntityResource()->m_Entity = NULL;
|
|
|
#endif //_WIN32
|
|
|
}
|
|
@@ -386,8 +386,8 @@ void SpEntity::__on_entity_prestart(sp_mod_entity_stub_t *, int trigger_entity_i
|
|
|
|
|
|
void SpEntity::__on_entity_stop(sp_mod_entity_stub_t *, int trigger_entity_id, int cause_code, void *user_data)
|
|
|
{
|
|
|
- SpEntity *pThis = static_cast<SpEntity*>(user_data);
|
|
|
Dbg("stop Entity");
|
|
|
+ SpEntity *pThis = static_cast<SpEntity*>(user_data);
|
|
|
pThis->on_entity_stop(trigger_entity_id, cause_code);
|
|
|
}
|
|
|
|
|
@@ -426,13 +426,17 @@ int SpEntity::on_accept(int epid, int svc_id, int conn_id, iobuffer_t **conn_pkt
|
|
|
sp_env_t *env = sp_get_env();
|
|
|
ErrorCodeEnum Error = Error_Succeed;
|
|
|
|
|
|
- if (!m_pEntityBase->IsService())
|
|
|
+ if (!m_pEntityBase->IsService()) {
|
|
|
+ sp_dbg_warn("current entity is no registed as service type, please confirm it at code scope.");
|
|
|
return Error_Bug;
|
|
|
+ }
|
|
|
|
|
|
sp_entity_t *remote_ent = sp_mod_mgr_find_entity_by_idx(env->mod_mgr, svc_id);
|
|
|
- if (!remote_ent)
|
|
|
+ if (!remote_ent) {
|
|
|
+ sp_dbg_error("cannot recognize the customer entity: %d!", svc_id);
|
|
|
return Error_Bug;
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
char *pszParam = NULL;
|
|
|
CServerSessionBase *pServerSessionBase = NULL;
|
|
|
iobuffer_format_read(*conn_pkt, "s", &pszParam);
|
|
@@ -523,7 +527,7 @@ ErrorCodeEnum SpEntity::SetTimer(DWORD nTimerID, ITimerListener *pListener, DWOR
|
|
|
if (Error) {
|
|
|
SpTimerListRemove(m_pTimerList, pTimer);
|
|
|
SpTimerDestroy(pTimer);
|
|
|
- sp_dbg_warn("start timer %d failed!", nTimerID);
|
|
|
+ sp_dbg_warn("start timer %d failed: %d!", nTimerID, Error);
|
|
|
} else {
|
|
|
sp_dbg_info("timer %d added! interval = %d", nTimerID, dwInterval);
|
|
|
}
|
|
@@ -728,6 +732,7 @@ ErrorCodeEnum SpEntity::EnumKeyOfPersistObject(const char *pszClass,CSimpleStrin
|
|
|
return Error_NotExist;
|
|
|
}
|
|
|
pIterator->Current = 0;
|
|
|
+ //TODO: x64 environment, depend on how to use the out-param
|
|
|
handle = (uintptr_t)(static_cast<void*>(pIterator));
|
|
|
//Handle = (DWORD)pIterator;
|
|
|
} else {
|
|
@@ -763,7 +768,7 @@ ErrorCodeEnum SpEntity::SubscribeLog(CUUID &SubscribeID, ILogListener *pListener
|
|
|
if (pszEntityName) {
|
|
|
ent = sp_mod_mgr_find_entity_by_name(sp_get_env()->mod_mgr, pszEntityName);
|
|
|
if (!ent) {
|
|
|
- sp_dbg_debug("SubscribeLog failed! Entity %s not exist!", pszEntityName);
|
|
|
+ sp_dbg_error("SubscribeLog failed! Entity %s not exist!", pszEntityName);
|
|
|
return Error_NotExist;
|
|
|
}
|
|
|
}
|
|
@@ -1006,7 +1011,7 @@ ErrorCodeEnum SpEntity::UnsubscribeBroadcast(const char *pszRemoteEntity)
|
|
|
|
|
|
ErrorCodeEnum SpEntity::LogMessage( const LogTypeEnum LogType, const SeverityLevelEnum Level, DWORD dwSysErrorCode, DWORD dwUserErrorCode, const char *pMessage )
|
|
|
{
|
|
|
- // xkm@20160726: У��dwUserErrorCode�Ƿ�Ϸ�
|
|
|
+ // xkm@20160726: 校验 dwUserErrorCode 是否合法
|
|
|
int nDevID = m_ent->cfg->devel_id;
|
|
|
if (dwUserErrorCode!=0 && ((dwUserErrorCode >> 20) & nDevID) != nDevID)
|
|
|
{
|
|
@@ -1157,14 +1162,14 @@ ErrorCodeEnum SpEntity::GetInstallInfo(CVersion Version,CInstallInfo &Info)
|
|
|
|
|
|
bool SpEntity::IsPackInstalled(const char *pPackName)
|
|
|
{
|
|
|
- if (pPackName)
|
|
|
+ if (pPackName && strlen(pPackName) > 0)
|
|
|
{
|
|
|
sp_env_t *env = sp_get_env();
|
|
|
sp_cfg_t *cfg = env->cfg;
|
|
|
sp_cfg_root_ini_t *root_ini = cfg->root_ini;
|
|
|
sp_cfg_install_ini_t *install_ini = cfg->install_ini;
|
|
|
|
|
|
- // �Ȳ�ѯ��ǰ�汾��������װ��ʷ
|
|
|
+ // 先查询当前版本的轻量安装历史
|
|
|
if (strstr(install_ini->light_packs, pPackName) != NULL)
|
|
|
{
|
|
|
for(int i=0; i<install_ini->arr_light_pack->nelts; i++)
|
|
@@ -1175,7 +1180,7 @@ bool SpEntity::IsPackInstalled(const char *pPackName)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // ��ѯ��ʷ�汾��װ��
|
|
|
+ // 查询历史版本安装包
|
|
|
for(int i=0; i<install_ini->arr_version->nelts; i++)
|
|
|
{
|
|
|
sp_cfg_version_info_t *ver_info = ARRAY_IDX(cfg->install_ini->arr_version, i, sp_cfg_version_info_t*);
|
|
@@ -1272,7 +1277,7 @@ ErrorCodeEnum SpEntity::GetPath(const char *pszKey,CSimpleStringA &strPath)
|
|
|
} else if (_stricmp(pszKey, "CenterSetting") == 0) {
|
|
|
// return centersetting name by current site
|
|
|
strPath = CSimpleStringA(env->dir->cfg_path);
|
|
|
- strPath += "\\";
|
|
|
+ strPath += SPLIT_SLASH_STR;
|
|
|
strPath += GetCenterSettingNameBySite();
|
|
|
}
|
|
|
else {
|
|
@@ -1381,7 +1386,10 @@ ErrorCodeEnum SpEntity::GetAllRegistSpFile(CAutoArray<CSimpleStringA> &Names)
|
|
|
|
|
|
Names.Init(arr_module->nelts);
|
|
|
for (int i = 0; i < arr_module->nelts; ++i) {
|
|
|
- Names[i] = ARRAY_IDX(arr_module, i, char*);
|
|
|
+ sp_cfg_shell_module_t* mod = ARRAY_IDX(arr_module, i, sp_cfg_shell_module_t*);
|
|
|
+ Names[i] = mod->name;
|
|
|
+ // BugFix [Gifur@2020422]
|
|
|
+ //Names[i] = ARRAY_IDX(arr_module, i, char*);
|
|
|
}
|
|
|
|
|
|
return Error_Succeed;
|