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


C++ ConnectionManager类代码示例

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


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

示例1: initConnections

void  PolypeerServer::initConnections()
{
	// liste des déploiements
	vector<File*>* files = sData->getDeployFiles();

	ConnectionManager* cm = sData->getConnectionManager();

	set<Entity*> myHostSet;

	for (vector<File*>::iterator itFile = files->begin(); itFile != files->end(); itFile++)
	{
		if(((*itFile)->getFileState() == READY) || ((*itFile)->getFileState() == DEPLOYMENT))
		{
			vector<Entity*>* hosts = (*itFile)->getDeploysOn();

			for (vector<Entity*>::iterator itHost = hosts->begin(); itHost != hosts->end(); itHost++)
			{
				myHostSet.insert((*itHost));
			}
		}
	}

	for (set<Entity*>::iterator itHost = myHostSet.begin(); itHost != myHostSet.end(); itHost++)
	{
		pthread_t myThread;
		if(cm->getConnection((*itHost)->getIP()) == NULL)
		{
			pthread_create(&myThread, NULL, thread_initConnection, (*itHost));
		}
	}
}
开发者ID:Lulububu,项目名称:PolyPeer,代码行数:31,代码来源:PolypeerServer.cpp

示例2: GetManager

bool 
RedundantDataPath::IsAValidConfiguration( U32 &errorString ){

	// the connection # check
	if( (GetChildCount() > 2) || (GetChildCount() < 1 ) ){
		errorString = CTS_SSAPI_CM_INVALID_CONN_COUNT_FOR_RDP;
		return false;
	}

	// must belong to the same host
	HostManager *pHM = (HostManager *)GetObjectManager( GetManager(), SSAPI_MANAGER_CLASS_TYPE_HOST_MANAGER );
	if( !pHM->DoConnectionsBelongToSameHost( m_children ) ){
		errorString = CTS_SSAPI_CM_CONN_MUST_BELONG_2_SAME_HOST;
		return false;
	}

	// must map to a single primary/fail-over IOP pair
	if( GetChildCount() == 2 ){
		DeviceManager		*pDM = (DeviceManager *)GetObjectManager(GetManager(), SSAPI_MANAGER_CLASS_TYPE_DEVICE_MANAGER );
		ConnectionManager	*pCM = (ConnectionManager *)GetManager();
		DesignatorId		id1 = GetChildIdAt( 0 ), id2 = GetChildIdAt( 1 );

		id1 = ((ConnectionBase *)pCM->GetManagedObject( &id1 ))->GetGeminiPortId();
		id2 = ((ConnectionBase *)pCM->GetManagedObject( &id2 ))->GetGeminiPortId();
		if( !pDM->AreThesePortsOnPartneredNacs( id1, id2 ) ){
			errorString = CTS_SSAPI_CM_CONN_MUST_BE_ON_PARTNER_NACS;
			return false;
		}
	}

	// we made it to here? Gee, it's good then!!!
	return true;
}
开发者ID:JoeAltmaier,项目名称:Odyssey,代码行数:33,代码来源:RedundantDataPath.cpp

示例3: ConnectionEncryptedHandler

//When a connection changes to encrypted
void ConnectionManager::ConnectionEncryptedHandler(ble_evt_t* bleEvent)
{
	ConnectionManager* cm = ConnectionManager::getInstance();
	Connection* c = cm->GetConnectionFromHandle(bleEvent->evt.gap_evt.conn_handle);

	logt("CM", "Connection id %u is now encrypted", c->connectionId);
	c->encryptionState = Connection::EncryptionState::ENCRYPTED;

	//We are peripheral
	if(c->direction == Connection::CONNECTION_DIRECTION_IN)
	{
		if(!cm->doHandshake){
			c->connectionState = Connection::ConnectionState::HANDSHAKE_DONE;
		}
	}
	//We are central
	else if(c->direction == Connection::CONNECTION_DIRECTION_OUT)
	{
		if(cm->doHandshake)
		{
			c->StartHandshake();
		}
		//If the handshake is disabled, we just set the variable
		else
		{
			c->connectionState = Connection::ConnectionState::HANDSHAKE_DONE;
		}
	}
}
开发者ID:Informatic,项目名称:fruitymesh,代码行数:30,代码来源:ConnectionManager.cpp

示例4: CurlOpenSocketCallback

curl_socket_t ConnectionManager::CurlOpenSocketCallback(void* clientp,
                                                        curlsocktype socket_type,
                                                        curl_sockaddr* address) {
    
    ConnectionManager* manager = static_cast<ConnectionManager*>(clientp);
    return manager->OpenSocket(socket_type, address);
}
开发者ID:Zplutor,项目名称:curlion,代码行数:7,代码来源:connection_manager.cpp

示例5: DisconnectionHandler

//Is called whenever a connection had been established and is now disconnected
//due to a timeout, deliberate disconnection by the localhost, remote, etc,...
void ConnectionManager::DisconnectionHandler(ble_evt_t* bleEvent)
{

	ConnectionManager* cm = ConnectionManager::getInstance();
	Connection* connection = cm->GetConnectionFromHandle(bleEvent->evt.gap_evt.conn_handle);

	if(connection == NULL) return;

	//Save disconnction reason
	connection->disconnectionReason = bleEvent->evt.gap_evt.params.disconnected.reason;

	//LOG disconnection reason
	Logger::getInstance().logError(Logger::errorTypes::HCI_ERROR, bleEvent->evt.gap_evt.params.disconnected.reason, cm->node->appTimerMs);

	logt("CM", "Connection %u to %u DISCONNECTED", connection->connectionId, connection->partnerId);

	//Check if the connection should be sustained (If it's been handshaked for more than 10 seconds and ran into a timeout)
	if(
			cm->node->appTimerMs - connection->connectionHandshakedTimestamp > 10 * 1000
			&& bleEvent->evt.gap_evt.params.disconnected.reason == BLE_HCI_CONNECTION_TIMEOUT
			&& cm->node->currentDiscoveryState != discoveryState::HANDSHAKE
			&& cm->node->currentDiscoveryState != discoveryState::REESTABLISHING_CONNECTION
	){
		logt("CM", "Connection should be sustained");

		//TODO: implement

		/*connection->connectionState = Connection::REESTABLISHING;

		cm->node->ChangeState(discoveryState::REESTABLISHING_CONNECTION);

		//We assume the same role as before the connection loss
		if(connection->direction == Connection::ConnectionDirection::CONNECTION_DIRECTION_IN){
			//We advertise
			AdvertisingController::SetAdvertisingState(advState::ADV_STATE_HIGH);
		} else {
			//We try to initiate the connection
			GAPController::connectToPeripheral(&connection->partnerAddress, Config->meshExtendedConnectionTimeout);

		}*/

	}


	if (connection->direction == Connection::CONNECTION_DIRECTION_IN) cm->freeInConnections++;
	else cm->freeOutConnections++;

	//If this was the pending connection, we clear it
	if(cm->pendingConnection == connection) cm->pendingConnection = NULL;

	//Notify the connection itself
	connection->DisconnectionHandler(bleEvent);

	//Notify the callback of the disconnection (The Node probably)
	cm->connectionManagerCallback->DisconnectionHandler(bleEvent);

	//Reset connection variables
	connection->ResetValues();
}
开发者ID:Informatic,项目名称:fruitymesh,代码行数:61,代码来源:ConnectionManager.cpp

示例6: main

int main(int argc, char **argv)
{
    qInstallMsgHandler(messageOutput);
    
    QCoreApplication app(argc, argv);
    ConnectionManager manager;
    manager.init();
    return app.exec();
}
开发者ID:husninazer,项目名称:qt,代码行数:9,代码来源:main.cpp

示例7: CurlSocketCallback

int ConnectionManager::CurlSocketCallback(CURL* easy_handle,
                                          curl_socket_t socket,
                                          int action,
                                          void* user_pointer,
                                          void* socket_pointer) {
    
    ConnectionManager* manager = static_cast<ConnectionManager*>(user_pointer);
    manager->WatchSocket(socket, action, socket_pointer);
    return 0;
}
开发者ID:Zplutor,项目名称:curlion,代码行数:10,代码来源:connection_manager.cpp

示例8: updateConnectionInformation

/*!
  Updates the connection information and notifies the UI of the changes.
*/
void TicTacEngine::updateConnectionInformation()
{
    ConnectionManager *connectionManager = mServer->connectionManager();

    if (connectionManager) {
        mSSID = connectionManager->accessPoint();
        mIpAndPort = connectionManager->myIp() + ":" + QString::number(SERVER_PORT);
        emit ssidChanged(mSSID);
        emit ipAndPortChanged(mIpAndPort);
    }
}
开发者ID:Alex237,项目名称:tic-tac-toe-qt,代码行数:14,代码来源:tictacengine.cpp

示例9: handleDiscoveredCallback

//When the mesh handle has been discovered
void ConnectionManager::handleDiscoveredCallback(u16 connectionHandle, u16 characteristicHandle)
{
	ConnectionManager* cm = ConnectionManager::getInstance();

	Connection* connection = cm->GetConnectionFromHandle(connectionHandle);
	if (connection != NULL)
	{
		connection->writeCharacteristicHandle = characteristicHandle;

		if(cm->doHandshake) connection->StartHandshake();
		else {
			cm->connectionManagerCallback->ConnectionSuccessfulHandler(NULL);
		}
	}
}
开发者ID:Informatic,项目名称:fruitymesh,代码行数:16,代码来源:ConnectionManager.cpp

示例10: augeGetLoggerInstance

	RESULTCODE GetDataSourceResponse::Write(WebWriter* pWriter)
	{
		if(pWriter==NULL)
		{
			return AG_FAILURE;
		}

		GLogger* pLogger = augeGetLoggerInstance();

		Workspace* pWorkspace = NULL;
		ConnectionManager* pConnManager = augeGetConnectionManagerInstance();

		XDocument	*pxDoc = new XDocument();
		XElement	*pxRoot = pxDoc->CreateRootNode("IMS_DataSources", NULL, NULL);

		const char* name = m_pRequest->GetName();
		if(name==NULL)
		{
			g_uint count = pConnManager->GetCount();
			for(g_uint i=0; i<count; i++)
			{
				pWorkspace = pConnManager->GetWorkspace(i);
				AddDataSourceNode(pxRoot, pWorkspace);
			}
		}
		else
		{
			pWorkspace = pConnManager->GetWorkspace(name);
			if(pWorkspace!=NULL)
			{
				AddDataSourceNode(pxRoot, pWorkspace);
			}
		}

		int len = 0;
		g_uchar* buffer = NULL;
		pxDoc->WriteToString(&buffer, len, "GBK",0);

		pWriter->WriteHead(m_pRequest->GetMimeType());
		pWriter->Write(buffer, len);
		pWriter->WriteTail();

		pLogger->Info((g_char*)buffer);

		pxDoc->Close();
		AUGE_SAFE_RELEASE(pxDoc);
		return AG_SUCCESS;
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:48,代码来源:GetDataSourceResponse.cpp

示例11:

postgis_datasource::~postgis_datasource()
{
    if (is_bound_ && ! persist_connection_)
    {
        ConnectionManager* mgr = ConnectionManager::instance();
        shared_ptr< Pool<Connection,ConnectionCreator> > pool = mgr->getPool(creator_.id());
        if (pool)
        {
            shared_ptr<Connection> conn = pool->borrowObject();
            if (conn)
            {
                conn->close();
            }
        }
    }
}
开发者ID:zenxiaoshu,项目名称:mapnik,代码行数:16,代码来源:postgis_datasource.cpp

示例12: main

int main(int argc, char *argv[])
{
  ConnectionManager connection;
  SOCKET connect_socket = connection.CreateClientConnection();

  #pragma region WYSYLANIE

  #define DEFAULT_BUFLEN 512

  int recvbuflen = DEFAULT_BUFLEN;

  char *sendbuf = new char[DEFAULT_BUFLEN];
  char recvbuf[DEFAULT_BUFLEN];

  int result = 0;

  do {
  printf("Wiadomosc do wyslania: \n");
  scanf("%s", sendbuf);
  //printf("Wiadomosc jaka wysle: %s\n", sendbuf);

  if (strcmp(sendbuf, "quit") == 0) break;
  // Send an initial buffer
  result = send(connect_socket, sendbuf, static_cast<int>(strlen(sendbuf)), 0);
  if (result == SOCKET_ERROR) {
  printf("send failed: %d\n", WSAGetLastError());
  closesocket(connect_socket);
  WSACleanup();
  //
  getch();
  //
  return 1;
  }
  } while (true);

  #pragma endregion blok odpowiedzialny za komunikacje z serwerem

  connection.ShutdownConnection(connect_socket);

	printf("Client exit.\n");
	getch();
	return 0;
}
开发者ID:krodzik,项目名称:MyFTP,代码行数:43,代码来源:Client.cpp

示例13: connect

void WaveExplorerUi::InitConnector()
{
    connect(xyz_rbtn_, SIGNAL(clicked()), this, SLOT(OnXYZAction()));
    connect(x_rbtn_, SIGNAL(clicked()), this, SLOT(OnXAction()));
    connect(y_rbtn_, SIGNAL(clicked()), this, SLOT(OnYAction()));
    connect(z_rbtn_, SIGNAL(clicked()), this, SLOT(OnZAction()));
    connect(tilt_to_dc_cbox_, SIGNAL(clicked(bool)), this, SLOT(OnTiltToDcAction(bool)));
    connect(bandpass_cbox_, SIGNAL(clicked(bool)), this, SLOT(OnBandPassAction(bool)));
    connect(notch_cbox_, SIGNAL(clicked(bool)), this, SLOT(OnNotchAction(bool)));
//    connect(min_dsbox_, SIGNAL(editingFinished()), this, SLOT(OnFreqValueChanged()));
//    connect(max_dsbox_, SIGNAL(editingFinished()), this, SLOT(OnFreqValueChanged()));
    connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(WaveItemClicked(QModelIndex)));

    ConnectionManager* mgr = ConnectionManager::GetInstance();
    if (mgr != NULL)
    {
        mgr->RegisterSignal(TYPE_WAVEEXPLORER_TOP_LAYER_TIME_EXPAND, this, SIGNAL(ExpandTimeSignal()));
    }
}
开发者ID:liye0005,项目名称:QT_POJ,代码行数:19,代码来源:waveexplorerui.cpp

示例14: CHECK_NOTNULL

void
ConnectionManager::addConnection(ManagedConnection* connection,
    bool timeout) {
  CHECK_NOTNULL(connection);
  ConnectionManager* oldMgr = connection->getConnectionManager();
  if (oldMgr != this) {
    if (oldMgr) {
      // 'connection' was being previously managed in a different thread.
      // We must remove it from that manager before adding it to this one.
      oldMgr->removeConnection(connection);
    }
    conns_.push_back(*connection);
    connection->setConnectionManager(this);
    if (callback_) {
      callback_->onConnectionAdded(*this);
    }
  }
  if (timeout) {
    scheduleTimeout(connection);
  }
}
开发者ID:Kbrunham,项目名称:folly,代码行数:21,代码来源:ConnectionManager.cpp

示例15: augeGetLoggerInstance

	FeatureClass* DescribeFeatureTypeHandler::GetFeatureClassBySource(WebRequest* pWebRequest, WebContext* pWebContext, User* pUser)
	{
		const char* typeName = NULL;
		Layer* pLayer = NULL;
		GLogger *pLogger = augeGetLoggerInstance();
		DescribeFeatureTypeRequest* pRequest = static_cast<DescribeFeatureTypeRequest*>(pWebRequest);
		typeName = pRequest->GetTypeName();

		const char* sourceName = pRequest->GetSourceName();
		if(sourceName==NULL)
		{
			GError* pError = augeGetErrorInstance();
			pError->SetError("No Source is attached");
			return NULL;
		}

		ConnectionManager* pConnManager = augeGetConnectionManagerInstance();
		Workspace* pWorkspace = pConnManager->GetWorkspace(pUser->GetID(), sourceName);
		if(pWorkspace==NULL)
		{
			char msg[AUGE_MSG_MAX];
			g_sprintf(msg, "No DataSource Named [%s]", sourceName);
			GError* pError = augeGetErrorInstance();
			pError->SetError(msg);
			return NULL;
		}

		FeatureWorkspace* pFeatureWorkspace = dynamic_cast<FeatureWorkspace*>(pWorkspace);
		FeatureClass* pFeatureClass = pFeatureWorkspace->OpenFeatureClass(typeName);
		if(pFeatureClass==NULL)
		{
			char msg[AUGE_MSG_MAX];
			g_sprintf(msg, "Cannot Get FeatureType %s",typeName);
			pLogger->Error(msg, __FILE__, __LINE__);
			GError* pError = augeGetErrorInstance();
			pError->SetError(msg);
			return NULL;
		}
		return pFeatureClass;
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:40,代码来源:DescribeFeatureTypeHandler.cpp


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