void FileMsgServerConn::_HandleGetServerAddressReq(CImPdu* pPdu) {
    IM::Server::IMFileServerIPRsp msg;
    
    const std::list<IM::BaseDefine::IpAddr>& addrs = ConfigUtil::GetInstance()->GetAddressList();
    
    for (std::list<IM::BaseDefine::IpAddr>::const_iterator it=addrs.begin(); it!=addrs.end(); ++it) {
        IM::BaseDefine::IpAddr* addr = msg.add_ip_addr_list();
        *addr = *it;
        log("Upload file_client_conn addr info, ip=%s, port=%d", addr->ip().c_str(), addr->port());
    }
    
    SendMessageLite(this, SID_OTHER, CID_OTHER_FILE_SERVER_IP_RSP, pPdu->GetSeqNum(), &msg);
}
Example #2
0
void CFileConn::_HandleGetServerAddressReq(CImPdu* pPdu)
{
    IM::Server::IMFileServerIPRsp msg;
    for (auto ip_addr_tmp : g_addr)
    {
        auto ip_addr = msg.add_ip_addr_list();
        *ip_addr = ip_addr_tmp;
    }
    CImPdu pdu;
    pdu.SetPBMsg(&msg);
    pdu.SetServiceId(SID_OTHER);
    pdu.SetCommandId(CID_OTHER_FILE_SERVER_IP_RSP);
    pdu.SetSeqNum(pPdu->GetSeqNum());
	SendPdu(&pdu);
	return;
}