mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Run editor auto-reload on any local address, and not just localhost
This commit is contained in:
parent
9d920b3575
commit
358cd20183
|
@ -8606,12 +8606,20 @@ void CEditor::HandleWriterFinishJobs()
|
||||||
{
|
{
|
||||||
CServerInfo CurrentServerInfo;
|
CServerInfo CurrentServerInfo;
|
||||||
Client()->GetServerInfo(&CurrentServerInfo);
|
Client()->GetServerInfo(&CurrentServerInfo);
|
||||||
NETADDR ServerAddr = Client()->ServerAddress();
|
|
||||||
const unsigned char aIpv4Localhost[16] = {127, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
|
||||||
const unsigned char aIpv6Localhost[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
|
|
||||||
|
|
||||||
// and if we're on localhost
|
NETADDR pAddr = Client()->ServerAddress();
|
||||||
if(!mem_comp(ServerAddr.ip, aIpv4Localhost, sizeof(aIpv4Localhost)) || !mem_comp(ServerAddr.ip, aIpv6Localhost, sizeof(aIpv6Localhost)))
|
char aAddrStr[NETADDR_MAXSTRSIZE];
|
||||||
|
net_addr_str(&Client()->ServerAddress(), aAddrStr, sizeof(aAddrStr), true);
|
||||||
|
|
||||||
|
// and if we're on a local address
|
||||||
|
bool IsLocalAddress = false;
|
||||||
|
if(pAddr.ip[0] == 127 || pAddr.ip[0] == 10 || (pAddr.ip[0] == 192 && pAddr.ip[1] == 168) || (pAddr.ip[0] == 172 && (pAddr.ip[1] >= 16 && pAddr.ip[1] <= 31)))
|
||||||
|
IsLocalAddress = true;
|
||||||
|
|
||||||
|
if(str_startswith(aAddrStr, "[fe80:") || str_startswith(aAddrStr, "[::1"))
|
||||||
|
IsLocalAddress = true;
|
||||||
|
|
||||||
|
if(IsLocalAddress)
|
||||||
{
|
{
|
||||||
char aMapName[128];
|
char aMapName[128];
|
||||||
IStorage::StripPathAndExtension(pJob->GetRealFileName(), aMapName, sizeof(aMapName));
|
IStorage::StripPathAndExtension(pJob->GetRealFileName(), aMapName, sizeof(aMapName));
|
||||||
|
|
Loading…
Reference in a new issue