外部设置令牌控制器显示消息日志时是否显示远程地址
This commit is contained in:
parent
32a8c2c263
commit
e3dd1bc5d9
|
@ -196,6 +196,7 @@ TokenClient* AP0801::CreateClient()
|
|||
// 建立内网控制器
|
||||
auto token2 = new TokenController();
|
||||
token2->Port = dynamic_cast<ITransport*>(socket);
|
||||
token2->ShowRemote = true;
|
||||
client->Local = token2;
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ void TokenClient::SayHello(bool broadcast)
|
|||
{
|
||||
TS("TokenClient::SayHello");
|
||||
|
||||
auto ctrl = broadcast ? Control : Local;
|
||||
auto ctrl = !broadcast ? Control : Local;
|
||||
if(!ctrl) return;
|
||||
|
||||
TokenMessage msg(0x01);
|
||||
|
|
|
@ -63,6 +63,8 @@ TokenController::TokenController() : Controller(), Key(0)
|
|||
|
||||
Server = nullptr;
|
||||
|
||||
ShowRemote = false;
|
||||
|
||||
// 默认屏蔽心跳日志和确认日志
|
||||
Buffer(NoLogCodes, sizeof(NoLogCodes)).Clear();
|
||||
NoLogCodes[0] = 0x03;
|
||||
|
@ -318,13 +320,15 @@ void TokenController::ShowMessage(cstring action, const Message& msg)
|
|||
|
||||
debug_printf("Token::%s ", action);
|
||||
|
||||
if (msg.State)
|
||||
if (ShowRemote || msg.State)
|
||||
{
|
||||
auto svr = (IPEndPoint*)Server;
|
||||
auto rmt = (IPEndPoint*)msg.State;
|
||||
if (!svr || svr->Address == IPAddress::Broadcast())
|
||||
//auto svr = (IPEndPoint*)Server;
|
||||
auto svr = (IPEndPoint*)msg.State;
|
||||
if(!svr) svr = (IPEndPoint*)Server;
|
||||
//if (!svr || svr->Address == IPAddress::Broadcast())
|
||||
if(svr)
|
||||
{
|
||||
rmt->Show();
|
||||
svr->Show();
|
||||
debug_printf(" ");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
ByteArray Key; // 通信密码
|
||||
|
||||
byte NoLogCodes[8]; // 没有日志的指令
|
||||
bool ShowRemote; // 消息日志中是否显示远程地址
|
||||
|
||||
TokenController();
|
||||
virtual ~TokenController();
|
||||
|
|
Loading…
Reference in New Issue