diff --git a/NodeServer/CommandLoad.h b/NodeServer/CommandLoad.h index 255f2b29..5fa98ef0 100644 --- a/NodeServer/CommandLoad.h +++ b/NodeServer/CommandLoad.h @@ -123,6 +123,9 @@ inline int CommandLoad::execute(string& sResult) _serverDir = TC_File::simplifyDirectory(_nodeInfo.dataDir + FILE_SEP + _desc.application + "." + _desc.serverName); } +//获取服务框架配置文件 + _confPath = _serverDir + FILE_SEP + "conf" + FILE_SEP; + _confFile = _confPath + _desc.application + "." + _desc.serverName + ".config.conf"; //若exePath不合法采用默认路径 //注意java服务启动方式特殊 可执行文件为java 须特殊处理 if (_exePath.empty()) @@ -130,10 +133,8 @@ inline int CommandLoad::execute(string& sResult) _exePath = _serverDir + FILE_SEP + "bin" + FILE_SEP; if (_serverType == "tars_java") { - string sConfigFile = _serverObjectPtr->getConfigFile(); - TC_Config conf; - conf.parseFile(sConfigFile); + conf.parseFile(_confFile); _exeFile = conf.get("/tars/application/server", "java"); } else if (_serverType == "tars_node") @@ -141,7 +142,7 @@ inline int CommandLoad::execute(string& sResult) string sConfigFile = _serverObjectPtr->getConfigFile(); TC_Config conf; - conf.parseFile(sConfigFile); + conf.parseFile(_confFile); _exeFile = conf.get("/tars/application/server", "node"); } else if(_serverType == "tars_php") @@ -149,7 +150,7 @@ inline int CommandLoad::execute(string& sResult) string sConfigFile = _serverObjectPtr->getConfigFile(); TC_Config conf; - conf.parseFile(sConfigFile); + conf.parseFile(_confFile); _exeFile = conf.get("/tars/application/server", "php"); } else @@ -204,11 +205,6 @@ inline int CommandLoad::execute(string& sResult) //创建配置lib文件目录 _libPath = _nodeInfo.dataDir + FILE_SEP + "lib" + FILE_SEP; - //获取服务框架配置文件 - _confPath = _serverDir + FILE_SEP + "conf" + FILE_SEP; - - _confFile = _confPath + _desc.application + "." + _desc.serverName + ".config.conf"; - NODE_LOG("KeepAliveThread")->debug() << "CommandLoad::execute"<< _serverType << "," << "exe_path=" << _exePath << "," << "exe_file=" << _exeFile << "," diff --git a/StatServer/StatHashMap.h b/StatServer/StatHashMap.h index 558730d5..40b5f8d4 100644 --- a/StatServer/StatHashMap.h +++ b/StatServer/StatHashMap.h @@ -28,13 +28,13 @@ // #include using namespace tars; -typedef TarsHashMap HashMap;//FileStorePolicy +//typedef TarsHashMap HashMap;//FileStorePolicy -// #if TARGET_PLATFORM_IOS || TARGET_PLATFORM_WINDOWS -// typedef TarsHashMap HashMap;//FileStorePolicy -// #else -// typedef TarsHashMap HashMap;//FileStorePolicy -// #endif + #if TARGET_PLATFORM_IOS || TARGET_PLATFORM_WINDOWS + typedef TarsHashMap HashMap;//FileStorePolicy + #else + typedef TarsHashMap HashMap;//FileStorePolicy + #endif #if TARGET_PLAFFORM_LINUX #include diff --git a/StatServer/StatServer.cpp b/StatServer/StatServer.cpp index 0901c4ac..33b21da2 100644 --- a/StatServer/StatServer.cpp +++ b/StatServer/StatServer.cpp @@ -237,10 +237,10 @@ void StatServer::initHashMap() _hashmap[i][k].initDataBlockSize(iMinBlock,iMaxBlock,iFactor); - if(TC_File::isFileExist(sHashMapFile)) - { - iSize = TC_File::getFileSize(sHashMapFile); - } +// if(TC_File::isFileExist(sHashMapFile)) +// { +// iSize = TC_File::getFileSize(sHashMapFile); +// } // else // { // int fd = open(sHashMapFile.c_str(), O_CREAT|O_EXCL|O_RDWR, 0666); @@ -270,21 +270,21 @@ void StatServer::initHashMap() //_hashmap[i][k].initStore( sHashMapFile.c_str(), iSize ); -// #if TARGET_PLATFORM_IOS || TARGET_PLATFORM_WINDOWS -// _hashmap[i][k].create(new char[iSize], iSize); -// #else +#if TARGET_PLATFORM_IOS || TARGET_PLATFORM_WINDOWS + _hashmap[i][k].create(new char[iSize], iSize); +#else // key_t key = ftok(sHashMapFile.c_str(), a[iChar%26]); - _hashmap[i][k].initStore( sHashMapFile.c_str(), iSize ); + // _hashmap[i][k].initStore( sHashMapFile.c_str(), iSize ); -// key_t key = tars::hash()(sHashMapFile); + key_t key = tars::hash()(sHashMapFile); // // iChar++; // TLOGDEBUG("init hash mem,shm key: 0x" << hex << key << dec << endl); -// _hashmap[i][k].initStore(key, iSize); -// #endif + _hashmap[i][k].initStore(key, iSize); +#endif _hashmap[i][k].setAutoErase(false); TLOGDEBUG("\n" << _hashmap[i][k].desc() << endl); diff --git a/tarscpp b/tarscpp index fc4578e0..467166aa 160000 --- a/tarscpp +++ b/tarscpp @@ -1 +1 @@ -Subproject commit fc4578e0c0c1d702bfdd953ed8743befafb2eced +Subproject commit 467166aa425c411cf4ff586e18300f526bb4ca1d