| 512 | } |
| 513 | |
| 514 | int CNetServer::OnSixupCtrlMsg(NETADDR &Addr, CNetChunk *pChunk, int ControlMsg, const CNetPacketConstruct &Packet, SECURITY_TOKEN &ResponseToken, SECURITY_TOKEN Token) |
| 515 | { |
| 516 | if(Packet.m_DataSize < 1 + (int)sizeof(SECURITY_TOKEN) || ClientExists(Addr)) |
| 517 | return 0; // silently ignore |
| 518 | |
| 519 | ResponseToken = ToSecurityToken(Packet.m_aChunkData + 1); |
| 520 | |
| 521 | if(ControlMsg == protocol7::NET_CTRLMSG_TOKEN) |
| 522 | { |
| 523 | if(Packet.m_DataSize >= (int)NET_TOKENREQUEST_DATASIZE) |
| 524 | { |
| 525 | SendTokenSixup(Addr, ResponseToken); |
| 526 | return 0; |
| 527 | } |
| 528 | |
| 529 | // Is this behaviour safe to rely on? |
| 530 | pChunk->m_Flags = 0; |
| 531 | pChunk->m_ClientId = -1; |
| 532 | pChunk->m_Address = Addr; |
| 533 | pChunk->m_DataSize = 0; |
| 534 | return 1; |
| 535 | } |
| 536 | else if(ControlMsg == NET_CTRLMSG_CONNECT) |
| 537 | { |
| 538 | SECURITY_TOKEN MyToken = GetToken(Addr); |
| 539 | unsigned char aToken[sizeof(SECURITY_TOKEN)]; |
| 540 | mem_copy(aToken, &MyToken, sizeof(aToken)); |
| 541 | |
| 542 | CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CONNECTACCEPT, aToken, sizeof(aToken), ResponseToken, true); |
| 543 | if(Token == MyToken) |
| 544 | TryAcceptClient(Addr, ResponseToken, false, true, Token); |
| 545 | } |
| 546 | |
| 547 | return 0; |
| 548 | } |
| 549 | |
| 550 | int CNetServer::GetClientSlot(const NETADDR &Addr) |
| 551 | { |
nothing calls this directly
no test coverage detected