本文整理汇总了C++中CClient::SetModule方法的典型用法代码示例。如果您正苦于以下问题:C++ CClient::SetModule方法的具体用法?C++ CClient::SetModule怎么用?C++ CClient::SetModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClient
的用法示例。
在下文中一共展示了CClient::SetModule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDvHeaderPacketIn
bool CDplusProtocol::OnDvHeaderPacketIn(CDvHeaderPacket *Header, const CIp &Ip)
{
bool newstream = false;
// find the stream
CPacketStream *stream = GetStream(Header->GetStreamId());
if ( stream == NULL )
{
// no stream open yet, open a new one
CCallsign via(Header->GetRpt1Callsign());
// first, check module is valid
if ( g_Reflector.IsValidModule(Header->GetRpt1Module()) )
{
// find this client
CClient *client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_DPLUS);
if ( client != NULL )
{
// now we know if it's a dextra dongle or a genuine dplus node
if ( Header->GetRpt2Callsign().HasSameCallsignWithWildcard(CCallsign("XRF*")) )
{
client->SetDextraDongle();
}
// now we know its module, let's update it
if ( !client->HasModule() )
{
client->SetModule(Header->GetRpt1Module());
}
// get client callsign
via = client->GetCallsign();
// and try to open the stream
if ( (stream = g_Reflector.OpenStream(Header, client)) != NULL )
{
// keep the handle
m_Streams.push_back(stream);
newstream = true;
}
}
// release
g_Reflector.ReleaseClients();
// update last heard
g_Reflector.GetUsers()->Hearing(Header->GetMyCallsign(), via, Header->GetRpt2Callsign());
g_Reflector.ReleaseUsers();
}
else
{
std::cout << "DPlus node " << via << " link attempt on non-existing module" << std::endl;
}
}
else
{
// stream already open
// skip packet, but tickle the stream
stream->Tickle();
// and delete packet
delete Header;
}
// done
return newstream;
}