int CTCPServerConnectionMonitor::_Process_CreateListenSocket() { int nFunRes = 0; try { DEF_DELETE(m_pTCPServerSocket); m_pTCPServerSocket = new TcpServerSocket<TcpSocket>(BIND_TO_ALL_INTERFACES, m_strListenSocketPort); m_pTCPServerSocket->bind(); m_pTCPServerSocket->listen(); _LOG(SourceFLInfo, DebugDebug, "server port = %s listening", m_strListenSocketPort.c_str()); m_SetTCPServerSocket.addSocket(m_pTCPServerSocket); nFunRes = 0; } catch (...) { _LOG(SourceFLInfo, DebugError, "bind server port = %s error!", m_strListenSocketPort.c_str()); DEF_DELETE(m_pTCPServerSocket); nFunRes = -1; return nFunRes; } return nFunRes; }
CAIElectLord::~CAIElectLord(void) { _CleanEnv(); DEF_DELETE(m_pCommonLogic); DEF_DELETE(m_pCardsHelper); m_pTestCards = NULL; }
/* ---------- open Открытие файла ---------- */ HRESULT File::Open(const char *file_name, BYTE file_mode, BYTE warnLevel/* = Filelevel_all*/) { if(this->_file) this->Close(); int len = int(strlen(file_name)); DEF_DELETE(this->_name); std::string path, oldDir = tools::GetCurDirectory(), fileName = tools::GetFileNameFromPath(file_name); if((path = tools::GetPathFromFilePath(file_name)).length()) //need to change directory { tools::SetCurDirectory(tools::GetCorePath()); if(path.length() && this->_mode != File_mode_READ) CreateDirectory(path.data(), 0); tools::SetCurDirectory(path); } //__log.PrintInfo(Filelevel_DEBUG, "=> [%s][%s]", path.data(), getCurrentDirectory().data()); this->_name = new char[len + 1]; memcpy(this->_name, file_name, len + 1); this->_mode = file_mode; char m[4]; switch(this->_mode) { case File_mode_WRITE: m[0] = 'w'; m[1] = 'b'; m[2] = '+'; m[3] = 0; break; case File_mode_READ: m[0] = 'r'; m[1] = 'b'; m[2] = 0; break; case File_mode_APPEND: m[0] = 'a'; m[1] = 'b'; m[2] = 0; break; case File_mode_EDIT: m[ 0 ] = 'r'; m[ 1 ] = 'b'; m[ 2 ] = '+'; m[ 3 ] = 0; break; } fopen_s(&this->_file, fileName.data(), m); __log.PrintInfo(Filelevel_DEBUG, "File::Open('%s') open in directory %s", fileName.data(), tools::GetCurDirectory().data()); if(path.length()) tools::SetCurDirectory(oldDir); if(this->_file == 0) { __log.PrintInfo(Filelevel_WARNING, "File::Open('%s', '%s') - can't open file", this->_name, m); return -1; } this->_length = tools::FileSize(this->_file); this->_logLevel = warnLevel; this->_cur_pos = 0; return 0; }//open
CGenerateSQLFile::~CGenerateSQLFile() { _ClossAllOutPutFiles(); DEF_DELETE(m_pSQLCodeInfo); m_vrtDataInFile.clear(); CLogger::removeInstance(); CUtilityFun::removeInstance(); CSQLDataProcessor::removeInstance(); }
int CTCPServerConnectionMonitor::_ProcessUserTerminate() { int nFunRes = 0; //user termin m_nThreadJobState = Job_State_End; if (NULL != m_pTCPServerRequestMonitor) { m_pTCPServerRequestMonitor->terminateAndWait(); DEF_DELETE(m_pTCPServerRequestMonitor); } if (NULL != m_pTCPServerSocket) { m_SetTCPServerSocket.removeSocket(m_pTCPServerSocket); DEF_DELETE(m_pTCPServerSocket); } return nFunRes; }
void CServerManager::removeInstance() { BOOST_LOG_FUNCTION(); boost::mutex::scoped_lock lock(m_instanceLock); if (NULL != m_pInstance) { DEF_DELETE(m_pInstance); } }
RenderableQuad::~RenderableQuad() { //TODO: because RenderableQuad inherited from ISprite, info deleted at ~ISprite /* if( this->info->indexInRenderableList != RENDERABLE_INDEX_UNDEFINED ) { this->info->DestroyExternalRenderableInListFunc( NULL, NULL, NULL, this->info->indexInRenderableList ); } else { */ //DEF_DELETE( this->info->animation ); //delete this->info; //} DEF_DELETE( this->info ); }//destructor
void CTableInfo::_FreeData() { std::list<CSQLType*>::iterator itemLst; CSQLType* pGet = NULL; itemLst = m_LstDBInfo.begin(); while (itemLst != m_LstDBInfo.end()) { pGet = (*itemLst); DEF_DELETE(pGet); itemLst++; } m_strTableName.clear(); m_LstDBInfo.clear(); }
void CPokerCardList::clearAllData() { int nFunRes = 0; CPokerCard* pPokderCardGet = NULL; std::list<CPokerCard*>::iterator iterList; iterList = m_pPokerCardList->begin(); while (iterList != m_pPokerCardList->end()) { pPokderCardGet = *iterList; DEF_DELETE(pPokderCardGet); iterList++; }//while m_pPokerCardList->clear(); }
int CTCPServerConnectionMonitor::_AcceptClient(TcpServerSocket<TcpSocket>* pTCPServerSocket) { int nFunRes = 0; TcpSocket* pNewClientSocket = NULL; CTCPConnectionActor* pActor = NULL; try { pNewClientSocket = pTCPServerSocket->accept(SERVER_NON_BLOCKING_ACCEPT, false); //SERVER_BLOCKING_ACCEPT nFunRes = 0; } catch(...) { _LOG(SourceFLInfo, DebugError, "ServerSocket accept new Tcp Client error"); DEF_DELETE(pNewClientSocket); nFunRes = -1; return nFunRes; } try { pActor = new CTCPConnectionActor(pNewClientSocket); pNewClientSocket = NULL; } catch (...) { DEF_DELETE(pActor); } m_pTCPServerRequestMonitor->addSocket(pActor); return nFunRes; }
/* ---------- Destructor ---------- */ File::~File() { this->Close(); if(this->_name) DEF_DELETE(this->_name); }//destructor
CCommonLogic::~CCommonLogic(void) { DEF_DELETE(m_pCardsHelper); }
CPokerCardList::~CPokerCardList(void) { m_pPokerCardList->clear(); DEF_DELETE(m_pPokerCardList); }