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


C++ QueryResult::getActiveConnectionToRemoteProxy方法代码示例

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


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

示例1: synchronize

    int AutoConnectionEntry::synchronize (void)
    {
        if ((_ui32RemoteProxyID == 0) || (_connectorType == CT_UNDEF)) {
            return -1;
        }

        _pConnectivitySolutions = _pConnectivitySolutions ? _pConnectivitySolutions : P_CONNECTION_MANAGER->findConnectivitySolutionsToProxyWithID (_ui32RemoteProxyID);
        if (!_pConnectivitySolutions) {
            return -2;
        }

        QueryResult query (_pConnectivitySolutions->getBestConnectionSolutionForConnectorType (_connectorType));
        Connection *pActiveConnection = query.getActiveConnectionToRemoteProxy();
        if (!pActiveConnection && !_pConnectivitySolutions->getRemoteProxyInfo().isRemoteProxyReachableFromLocalHost()) {
            // It is impossible to open a connection to the remote NetProxy from the local host
            return -3;
        }
        if (!pActiveConnection) {
            Connector * const pConnector = P_CONNECTION_MANAGER->getConnectorForType (_connectorType);
            if (!pConnector) {
                // Critical error!
                return -4;
            }

            pActiveConnection = pConnector->openNewConnectionToRemoteProxy (query, false);
            if (!pActiveConnection && pConnector->isConnectingToRemoteAddr(query.getRemoteProxyServerAddress())) {
                // Connection still establishing!
                return 0;
            }
            query = _pConnectivitySolutions->getBestConnectionSolutionForConnectorType (_connectorType);
            if (!(pActiveConnection = query.getActiveConnectionToRemoteProxy())) {
                // Connection failed
                return -5;
            }
        }

        pActiveConnection->lock();
        if (!pActiveConnection->isConnected()) {
            // Unexpected case
            pActiveConnection->unlock();
            return -6;
        }

        if (_bSynchronized) {
            // Nothing to do here
            pActiveConnection->unlock();
            return 0;
        }
        bool bReachable = _pConnectivitySolutions->getRemoteProxyInfo().isLocalProxyReachableFromRemote();
        if (0 != pActiveConnection->openConnectionWithRemoteProxy (query.getBestConnectionSolution(), bReachable)) {
            pActiveConnection->unlock();
            _bSynchronized = false;
            return -7;
        }
        pActiveConnection->unlock();
        _bSynchronized = true;

        return 0;
    }
开发者ID:agilecomputing,项目名称:nomads,代码行数:59,代码来源:AutoConnectionEntry.cpp


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