MCPcopy Create free account
hub / github.com/ddnet/ddnet / OnConfigChange

Method OnConfigChange

src/engine/server/register.cpp:571–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

569}
570
571void CRegister::OnConfigChange()
572{
573 bool aOldProtocolEnabled[NUM_PROTOCOLS];
574 for(int i = 0; i < NUM_PROTOCOLS; i++)
575 {
576 aOldProtocolEnabled[i] = m_aProtocolEnabled[i];
577 }
578 const char *pProtocols = m_pConfig->m_SvRegister;
579 if(str_comp(pProtocols, "1") == 0)
580 {
581 for(auto &Enabled : m_aProtocolEnabled)
582 {
583 Enabled = true;
584 }
585 }
586 else if(str_comp(pProtocols, "0") == 0)
587 {
588 for(auto &Enabled : m_aProtocolEnabled)
589 {
590 Enabled = false;
591 }
592 }
593 else
594 {
595 for(auto &Enabled : m_aProtocolEnabled)
596 {
597 Enabled = false;
598 }
599 char aBuf[16];
600 while((pProtocols = str_next_token(pProtocols, ",", aBuf, sizeof(aBuf))))
601 {
602 int Protocol;
603 if(str_comp(aBuf, "ipv6") == 0)
604 {
605 m_aProtocolEnabled[PROTOCOL_TW6_IPV6] = true;
606 m_aProtocolEnabled[PROTOCOL_TW7_IPV6] = true;
607 }
608 else if(str_comp(aBuf, "ipv4") == 0)
609 {
610 m_aProtocolEnabled[PROTOCOL_TW6_IPV4] = true;
611 m_aProtocolEnabled[PROTOCOL_TW7_IPV4] = true;
612 }
613 else if(str_comp(aBuf, "tw0.6") == 0)
614 {
615 m_aProtocolEnabled[PROTOCOL_TW6_IPV6] = true;
616 m_aProtocolEnabled[PROTOCOL_TW6_IPV4] = true;
617 }
618 else if(str_comp(aBuf, "tw0.7") == 0)
619 {
620 m_aProtocolEnabled[PROTOCOL_TW7_IPV6] = true;
621 m_aProtocolEnabled[PROTOCOL_TW7_IPV4] = true;
622 }
623 else if(!ProtocolFromString(&Protocol, aBuf))
624 {
625 m_aProtocolEnabled[Protocol] = true;
626 }
627 else
628 {

Callers 3

LoadMapMethod · 0.80
RunMethod · 0.80

Calls 6

str_compFunction · 0.85
str_next_tokenFunction · 0.85
str_findFunction · 0.85
SendRegisterMethod · 0.80
str_copyFunction · 0.50

Tested by

no test coverage detected