diff --git a/config/serverblacklist.cfg b/config/serverblacklist.cfg index d4fef5cc..4c5f61c5 100644 --- a/config/serverblacklist.cfg +++ b/config/serverblacklist.cfg @@ -8,6 +8,5 @@ // 1.2.3.4/24 = Ban an IP block (1.2.3.0 - 1.2.3.255) // 1.2.3.4 - 2.3.4.5 = Ban an IP range. -// Hint: sed 's!#!//!g' old_blacklist.txt > new_blacklist.cfg diff --git a/source/src/autodownload.cpp b/source/src/autodownload.cpp index d2354050..43146e0f 100644 --- a/source/src/autodownload.cpp +++ b/source/src/autodownload.cpp @@ -76,7 +76,7 @@ int pingpckserver(void *data) // fetch updates.txt from a media server, measure u.set(s->host); s->resolved = h.set_host(u.domain) ? 1 : 0; SDL_mutexP(pckpinglog_lock); - cvecprintf(pckping_log, "lresolving hostname %s %s (%s)\n", u.domain, s->resolved ? "succeeded" : "failed", iptoa(ntohl(h.ip.host))); + cvecprintf(pckping_log, "lresolving hostname %s %s (%s)\n", u.domain, s->resolved ? "succeeded" : "failed", iptoa(ENET_NET_TO_HOST_32(h.ip.host))); SDL_mutexV(pckpinglog_lock); if(s->resolved) { diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 3b30f97d..c26b753a 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -953,10 +953,9 @@ void dokill(playerent *pl, playerent *act, bool gib, int gun) exechook(HOOK_SP, "onKill", "%d %d %d %d", act->clientnum, pl->clientnum, gun, gib ? 1 : 0); - string pname, aname, death; - copystring(pname, pl==player1 ? "you" : colorname(pl)); - copystring(aname, act==player1 ? "you" : colorname(act)); - copystring(death, killmessage(gun, gib)); + const char *pname = pl == player1 ? "you" : colorname(pl); + const char *aname = act == player1 ? "you" : colorname(act); + const char *death = killmessage(gun, gib); void (*outf)(const char *s, ...) = (pl == player1 || act == player1) ? hudoutf : conoutf; if(pl==act) diff --git a/source/src/server.cpp b/source/src/server.cpp index a4085cf8..0872599a 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -101,7 +101,6 @@ long int incoming_size = 0; // cmod int totalclients = 0; int cn2boot; -int servertime = 0, serverlagged = 0; // synchronising the worker threads... @@ -3982,8 +3981,7 @@ void serverslice(uint timeout) // main server update, called from cube main lo int diff = nextmillis - servmillis; sg->gamemillis += diff; servmillis = nextmillis; - servertime = ((diff + 3 * servertime)>>2); - if (servertime > 40) serverlagged = servmillis; + entropy_add_byte(diff); #ifndef STANDALONE if(m_demo) @@ -3994,7 +3992,7 @@ void serverslice(uint timeout) // main server update, called from cube main lo } #endif - if(sg->minremain>0) + if(sg->minremain > 0) { processevents(); checkitemspawns(diff); @@ -4016,9 +4014,8 @@ void serverslice(uint timeout) // main server update, called from cube main lo if(m_ktf && !ktfflagingame) flagaction(rnd(2), FA_RESET, -1); // ktf flag watchdog if(m_arena) arenacheck(); else if(m_autospawn) autospawncheck(); -// if(m_lms) lmscheck(); sendextras(); - if ( scl.afk_limit && sg->mastermode == MM_OPEN && next_afk_check < servmillis && sg->gamemillis > 20 * 1000 ) check_afk(); + if(scl.afk_limit && sg->mastermode == MM_OPEN && next_afk_check < servmillis && sg->gamemillis > 20 * 1000) check_afk(); } if(curvote) @@ -4029,7 +4026,7 @@ void serverslice(uint timeout) // main server update, called from cube main lo int nonlocalclients = numnonlocalclients(); - if(sg->forceintermission || ((sg->smode>1 || (gamemode==0 && nonlocalclients)) && sg->gamemillis-diff>0 && sg->gamemillis/60000!=(sg->gamemillis-diff)/60000)) + if(sg->forceintermission || ((sg->smode > 1 || (gamemode == 0 && nonlocalclients)) && sg->gamemillis-diff > 0 && sg->gamemillis / 60000 != (sg->gamemillis - diff) / 60000)) checkintermission(); if(m_demo && !demoplayback) maprot.restart(); else if(sg->interm && ( (scl.demo_interm && sending_demo) ? sg->gamemillis > (sg->interm<<1) : sg->gamemillis > sg->interm ) ) @@ -4066,7 +4063,7 @@ void serverslice(uint timeout) // main server update, called from cube main lo if(servmillis - laststatus > 60 * 1000) // display bandwidth stats, useful for server ops { laststatus = servmillis; - rereadcfgs(); + if(!nonlocalclients) rereadcfgs(); // configs are read from actual files - only attempt to do that, when the server is empty if(nonlocalclients || serverhost->totalSentData || serverhost->totalReceivedData) { if(nonlocalclients) loggamestatus(NULL); @@ -4089,6 +4086,7 @@ void serverslice(uint timeout) // main server update, called from cube main lo if(enet_host_service(serverhost, &event, timeout) <= 0) break; serviced = true; } + entropy_add_byte(event.type); switch(event.type) { case ENET_EVENT_TYPE_CONNECT: @@ -4413,6 +4411,7 @@ int main(int argc, char **argv) #endif setlocale(LC_ALL, "POSIX"); + entropy_init(time(NULL) + (uint)(size_t)&scl + (uint)(size_t)"" + (uint)(size_t)entropy_init + (int)enet_time_get()); for(int i = 1; i < argc; i++) { diff --git a/source/src/serverms.cpp b/source/src/serverms.cpp index ea94fd76..b52f77eb 100644 --- a/source/src/serverms.cpp +++ b/source/src/serverms.cpp @@ -318,6 +318,7 @@ void serverms(int mode, int numplayers, int minremain, char *smapname, int milli } buf.dataLength = len + po.length(); + entropy_add_byte(addr.host ^ (addr.host >> 24)); enet_socket_send(pongsock, &addr, &buf, 1); if(std) *msend += (int)buf.dataLength; else *csend += (int)buf.dataLength;