当前位置: 首页>>代码示例>>C++>>正文


C++ SipxProcess::enable方法代码示例

本文整理汇总了C++中SipxProcess::enable方法的典型用法代码示例。如果您正苦于以下问题:C++ SipxProcess::enable方法的具体用法?C++ SipxProcess::enable怎么用?C++ SipxProcess::enable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SipxProcess的用法示例。


在下文中一共展示了SipxProcess::enable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DoEntryAction

void Disabled::DoEntryAction( SipxProcess& impl ) const
{
   impl.checkThreadId();
   impl.clearStatusMessages();

   if (impl.isEnabled())
   {
      impl.enable();
   }
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:10,代码来源:SipxProcessFsm.cpp

示例2: upgradeFrom3_0

void upgradeFrom3_0()
{
    // 3.0 had process definition files in /etc/sipxpbx/process.d
    UtlString oldProcessDefinitionDirectory =
        SipXecsService::Path(SipXecsService::ConfigurationDirType, "process-old.d");

    OsSysLog::add(FAC_SUPERVISOR, PRI_DEBUG,"upgradeFrom3_0: searching '%s'",
                  oldProcessDefinitionDirectory.data()
                 );

    if ( !OsFileSystem::exists( oldProcessDefinitionDirectory) )
    {
        return;
    }

    OsFileIterator definitions(oldProcessDefinitionDirectory);
    OsPath    oldProcessDefinitionFile;
    bool okToRemoveDir = true;   // set to false if any pre-4.0 process file cannot be upgraded
    for ( OsStatus iteratorStatus = definitions.findFirst(oldProcessDefinitionFile,
                                    OLD_PROCESS_DEFINITION_NAME_PATTERN,
                                    OsFileIterator::FILES);
            OS_SUCCESS == iteratorStatus;
            iteratorStatus = definitions.findNext(oldProcessDefinitionFile)
        )
    {
        OsPath oldProcessDefinitionPath( oldProcessDefinitionDirectory
                                         +OsPath::separator
                                         +oldProcessDefinitionFile
                                       );
        OsSysLog::add(FAC_SUPERVISOR, PRI_INFO,"upgradeFrom3_0: reading pre-4.0 process def '%s'",
                      oldProcessDefinitionPath.data()
                     );

        // read the process name and the watchdog enable setting,
        // and enable the process if necessary
        TiXmlDocument processDefinitionDoc(oldProcessDefinitionPath);

        bool definitionValid = true;
        UtlString errorMsg;
        if ( processDefinitionDoc.LoadFile() )
        {
            TiXmlElement *subroot = processDefinitionDoc.RootElement();
            if (subroot != NULL)
            {
                bool bEnabled=false;
                const char *enableString = subroot->Attribute("enable");
                if (enableString == NULL || strcmp(enableString, "true")==0)
                {
                    bEnabled=true;
                }

                TiXmlElement* processDefElement = subroot->FirstChildElement("process_definitions");
                if (processDefElement)
                {
                    TiXmlNode *pGroupNode = processDefElement->FirstChild("group");
                    if (pGroupNode)
                    {
                        TiXmlElement *processElement = pGroupNode->FirstChildElement("process");
                        if (processElement)
                        {
                            const char *pMsg = processElement->Attribute("name");
                            UtlString processName = pMsg;

                            // enable or disable process based on setting in old process def file
                            SipxProcess* newProcess;
                            if ((newProcess=SipxProcessManager::getInstance()->findProcess(processName)))
                            {
                                if (bEnabled)
                                {
                                    OsSysLog::add(FAC_SUPERVISOR, PRI_NOTICE,
                                                  "upgradeFrom3_0: enabling process '%s'", processName.data());
                                    newProcess->enable();
                                }
                                else
                                {
                                    OsSysLog::add(FAC_SUPERVISOR, PRI_NOTICE,
                                                  "upgradeFrom3_0: disabling process '%s'", processName.data());
                                    newProcess->disable();
                                }

                                if (OS_SUCCESS == OsFileSystem::remove(oldProcessDefinitionPath))
                                {
                                    OsSysLog::add(FAC_SUPERVISOR, PRI_NOTICE,
                                                  "upgradeFrom3_0: removing pre-4.0 process def file '%s'",
                                                  oldProcessDefinitionPath.data());
                                }
                                else
                                {
                                    OsSysLog::add(FAC_SUPERVISOR, PRI_ERR,
                                                  "upgradeFrom3_0: failed to remove pre-4.0 process def file '%s'",
                                                  oldProcessDefinitionPath.data());
                                }
                            }
                            else
                            {
                                OsSysLog::add(FAC_SUPERVISOR, PRI_ERR,
                                              "upgradeFrom3_0: could not find process '%s'", processName.data());
                                okToRemoveDir = false;
                            }
                        }
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的SipxProcess::enable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。