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


C++ ConnMap_t类代码示例

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


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

示例1: log

void CRouteConn::_HandleFriendStatusNotify(CImPduFriendStatusNotify* pPdu)
{
	uint32_t from_user_id = pPdu->GetFromUserId();
	uint32_t from_user_status = pPdu->GetFromUserStatus();
	uint32_t friend_cnt = pPdu->GetFriendCnt();

	log("HandleFriendNotify, from_id=%u, status=%u, friend_cnt=%u\n", from_user_id, from_user_status,
        friend_cnt);
    if (from_user_status == USER_STATUS_OFFLINE) {
        UserStatMap_t::iterator it = g_rs_user_map.find(from_user_id);
        if (it != g_rs_user_map.end()) {
            uint32_t status = it->second.status;
            if (status != USER_STATUS_OFFLINE) {
                // user is still online, do not send status leave status to other
                return;
            }
        }
	}
	for (ConnMap_t::iterator it = g_route_conn_map.begin();  it != g_route_conn_map.end(); it++) {
		CRouteConn* pConn = (CRouteConn*)it->second;
		if (pConn) {
			pConn->SendPdu(pPdu);
		}
	}
}
开发者ID:343829084,项目名称:IMServer,代码行数:25,代码来源:RouteConn.cpp

示例2: _BroadcastMsg

void CRouteConn::_BroadcastMsg(CImPdu* pPdu, CRouteConn* pFromConn)
{
	ConnMap_t::iterator it;
	for (it = g_route_conn_map.begin(); it != g_route_conn_map.end(); it++) {
		CRouteConn* pRouteConn = (CRouteConn*)it->second;
		if (pRouteConn != pFromConn) {
			pRouteConn->SendPdu(pPdu);
		}
	}
}
开发者ID:1059232202,项目名称:TeamTalk,代码行数:10,代码来源:RouteConn.cpp

示例3: FileClientConnTimerCallback

void FileClientConnTimerCallback(void* callback_data, uint8_t msg, uint32_t handle, void* pParam) {
    uint64_t cur_time = get_tick_count();
    for (ConnMap_t::iterator it = g_file_client_conn_map.begin(); it != g_file_client_conn_map.end(); ) {
        ConnMap_t::iterator it_old = it;
        it++;
        
        FileClientConn* conn = (FileClientConn*)it_old->second;
        conn->OnTimer(cur_time);
    }
}
开发者ID:1059232202,项目名称:TeamTalk,代码行数:10,代码来源:file_client_conn.cpp

示例4: route_serv_timer_callback

void route_serv_timer_callback(void* callback_data, uint8_t msg, uint32_t handle, void* pParam)
{
	uint64_t cur_time = get_tick_count();
	for (ConnMap_t::iterator it = g_route_conn_map.begin(); it != g_route_conn_map.end(); ) {
		ConnMap_t::iterator it_old = it;
		it++;

		CRouteConn* pConn = (CRouteConn*)it_old->second;
		pConn->OnTimer(cur_time);
	}
}
开发者ID:1059232202,项目名称:TeamTalk,代码行数:11,代码来源:RouteConn.cpp

示例5: netlib_close

void CRouteConn::Close()
{
	if (m_handle != NETLIB_INVALID_HANDLE) {
		netlib_close(m_handle);
		g_route_conn_map.erase(m_handle);
	}

	// remove all user info from this MessageServer
	UserStatMap_t::iterator it_old;
	for (UserStatMap_t::iterator it = g_rs_user_map.begin(); it != g_rs_user_map.end(); ) {
		it_old = it;
		it++;
        
		RouteConnMap_t::iterator conn_it = it_old->second.conns.find(this);
		if (conn_it != it_old->second.conns.end()) {
			it_old->second.conns.erase(conn_it);
            
			if (it_old->second.conns.empty()) {
				g_rs_user_map.erase(it_old);
			}
		}
	}

	ReleaseRef();
}
开发者ID:343829084,项目名称:IMServer,代码行数:25,代码来源:RouteConn.cpp

示例6: route_server_conn_timer_callback

void route_server_conn_timer_callback(void* callback_data, uint8_t msg, uint32_t handle, void* pParam)
{
	ConnMap_t::iterator it_old;
	CRouteServConn* pConn = NULL;
	uint64_t cur_time = get_tick_count();

	for (ConnMap_t::iterator it = g_route_server_conn_map.begin(); it != g_route_server_conn_map.end(); ) {
        it_old = it;
        it++;
        pConn = (CRouteServConn*)it_old->second;
        pConn->OnTimer(cur_time);
	}

	// reconnect RouteServer
	serv_check_reconnect<CRouteServConn>(g_route_server_list, g_route_server_count);
}
开发者ID:9618211,项目名称:TTServer,代码行数:16,代码来源:RouteServConn.cpp

示例7: db_server_conn_timer_callback

static void db_server_conn_timer_callback(void* callback_data, uint8_t msg, uint32_t handle, void* pParam)
{
	ConnMap_t::iterator it_old;
	CDBServConn* pConn = NULL;
	uint64_t cur_time = get_tick_count();

	for (ConnMap_t::iterator it = g_db_server_conn_map.begin(); it != g_db_server_conn_map.end(); ) {
		it_old = it;
		it++;

		pConn = (CDBServConn*)it_old->second;
		if (pConn->IsOpen()) {
			pConn->OnTimer(cur_time);
		}
	}

	// reconnect DB Storage Server
	// will reconnect in 4s, 8s, 16s, 32s, 64s, 4s 8s ...
	serv_check_reconnect<CDBServConn>(g_db_server_list, g_db_server_count);
}
开发者ID:0359xiaodong,项目名称:TeamTalk,代码行数:20,代码来源:DBServConn.cpp

示例8: login_conn_timer_callback

void login_conn_timer_callback(void* callback_data, uint8_t msg, uint32_t handle, void* pParam)
{
	//test
	uint64_t cur_time = get_tick_count();
	for (ConnMap_t::iterator it = g_client_conn_map.begin(); it != g_client_conn_map.end(); ) {
		ConnMap_t::iterator it_old = it;
		it++;

		CLoginConn* pConn = (CLoginConn*)it_old->second;
		pConn->OnTimer(cur_time);
	}

	for (ConnMap_t::iterator it = g_msg_serv_conn_map.begin(); it != g_msg_serv_conn_map.end(); ) {
		ConnMap_t::iterator it_old = it;
		it++;

		CLoginConn* pConn = (CLoginConn*)it_old->second;
		pConn->OnTimer(cur_time);
	}
}
开发者ID:jasonxu1015,项目名称:TeamTalk,代码行数:20,代码来源:LoginConn.cpp

示例9: login_conn_timer_callback

//每隔一秒,这个函数就会被调用一次
void login_conn_timer_callback(void* callback_data, uint8_t msg, uint32_t handle, void* pParam)
{
	log("enter[%s]", __FUNCTION__);

	//两个conn_map里所有的连接都要调用一次OnTimer()
	uint64_t cur_time = get_tick_count();
	for (ConnMap_t::iterator it = g_client_conn_map.begin(); it != g_client_conn_map.end(); ) {
		ConnMap_t::iterator it_old = it;
		it++;

		CLoginConn* pConn = (CLoginConn*)it_old->second;
		pConn->OnTimer(cur_time);
	}

	for (ConnMap_t::iterator it = g_msg_serv_conn_map.begin(); it != g_msg_serv_conn_map.end(); ) {
		ConnMap_t::iterator it_old = it;
		it++;

		CLoginConn* pConn = (CLoginConn*)it_old->second;
		pConn->OnTimer(cur_time);
	}
	log("leave[%s]", __FUNCTION__);

}
开发者ID:jasonxu1015,项目名称:TT_Centos7,代码行数:25,代码来源:LoginConn.cpp

示例10: Close

void CLoginConn::Close()
{
    if (m_handle != NETLIB_INVALID_HANDLE) 
    {
        netlib_close(m_handle);
        if (m_conn_type == LOGIN_CONN_TYPE_CLIENT) 
        {
            g_client_conn_map.erase(m_handle);
        } 
        else 
        {
            g_msg_serv_conn_map.erase(m_handle);

            // remove all user count from this message server
            map<uint32_t, msg_serv_info_t*>::iterator it = g_msg_serv_info.find(m_handle);
            if (it != g_msg_serv_info.end()) 
            {
                msg_serv_info_t* pMsgServInfo = it->second;

                g_total_online_user_cnt -= pMsgServInfo->cur_conn_cnt;
                log("onclose from MsgServer: %s:%u ", pMsgServInfo->hostname.c_str(), pMsgServInfo->port);
                
                delete pMsgServInfo;
                g_msg_serv_info.erase(it);
            }
        }
    }

    ReleaseRef();
}
开发者ID:zergl,项目名称:TeamTalk,代码行数:30,代码来源:LoginConn.cpp

示例11: OnConnect

void FileMsgServerConn::OnConnect(net_handle_t handle) {
    m_handle = handle;
    
    g_file_msg_server_conn_map.insert(make_pair(handle, this));
    netlib_option(handle, NETLIB_OPT_SET_CALLBACK, (void*)imconn_callback);
    netlib_option(handle, NETLIB_OPT_SET_CALLBACK_DATA, (void*)&g_file_msg_server_conn_map);
}
开发者ID:1059232202,项目名称:TeamTalk,代码行数:7,代码来源:file_msg_server_conn.cpp

示例12: Close

void CRouteConn::Close()
{
	if (m_handle != NETLIB_INVALID_HANDLE) {
		netlib_close(m_handle);
		g_route_conn_map.erase(m_handle);
	}

	// remove all user info from this MessageServer
    
    UserInfoMap_t::iterator it_old;
    for (UserInfoMap_t::iterator it = g_user_map.begin(); it != g_user_map.end(); )
    {
        it_old = it;
        it++;
        
        CUserInfo* pUser = it_old->second;
        pUser->RemoveRouteConn(this);
        if (pUser->GetRouteConnCount() == 0)
        {
            delete pUser;
            pUser = NULL;
            g_user_map.erase(it_old);
        }
    }

	ReleaseRef();
}
开发者ID:1059232202,项目名称:TeamTalk,代码行数:27,代码来源:RouteConn.cpp

示例13: connect

net_handle_t ClientConn::connect(const string& strIp, uint16_t nPort, const string& strName, const string& strPass)
{
	m_handle = netlib_connect(strIp.c_str(), nPort, imconn_callback, &g_client_conn_map);
	if(m_handle != NETLIB_INVALID_HANDLE)
		g_client_conn_map.insert(make_pair(m_handle, this));
    return  m_handle;
}
开发者ID:hlyces,项目名称:teamtalk_TT,代码行数:7,代码来源:ClientConn.cpp

示例14: Close

void ClientConn::Close()
{
	log("clientconn close from handle = %d\n", m_handle);
	if (m_handle != NETLIB_INVALID_HANDLE) {
		netlib_close(m_handle);
		g_client_conn_map.erase(m_handle);
	}
	ReleaseRef();
}
开发者ID:hlyces,项目名称:teamtalk_TT,代码行数:9,代码来源:ClientConn.cpp

示例15: OnConnect

void CRouteConn::OnConnect(net_handle_t handle)
{
	m_handle = handle;

	g_route_conn_map.insert(make_pair(handle, this));

	netlib_option(handle, NETLIB_OPT_SET_CALLBACK, (void*)imconn_callback);
	netlib_option(handle, NETLIB_OPT_SET_CALLBACK_DATA, (void*)&g_route_conn_map);
}
开发者ID:1059232202,项目名称:TeamTalk,代码行数:9,代码来源:RouteConn.cpp


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