In very rare, nearly impossible to replicate circumstances, it appears client/New() in some unknown unique case, fails to fire.
Numbered Steps to Reproduce Problem:
Can not reproduce.
Code Snippet (if applicable) to Reproduce Problem:
proc/UpdateUserlist()
//Update allusers list (sorting)
var/list/allusers=list()
for(var/mob/LM) if(isnull(LM.icon_state)) allusers += LM
for(var/mob/LM) if(LM.icon_state=="away") allusers += LM
for(var/mob/LM)
if(LM.client)
winset(LM,null,"userlist.cells=1x[clients];cusers.text=\"Users Online: [clients]\"")
var/ultracker=0
for(var/mob/ALU in allusers)
if(ALU.client)
ultracker++
LM << output(ALU,"userlist:1,[ultracker]")
var
clients=0
maxclients=0
client/New()
clients++
if(world.cpu > 94)
src << "<font color=#f00>* ERROR Server too busy please try again in a few minutes</font>"
return
if(byond_version < world.byond_version)
src << "<font color=#f00>* ERROR Please update your BYOND client (You: <b>[byond_version]</b> & Server: <b>[world.byond_version]</b>)</font>"
return
if(clients > scfg["max_users"])
src << "<font color=#f00>* ERROR Server is full</font>"
return
if(key in throttled)
src << "<font color=#f00>* ERROR - Connection Throttled - Please wait 60 seconds</font>"
return
if(ckey in banned_keys)
src << "<font color=#f00>* ERROR - Connection Refused - Key is banned</font>"
return
if(address in banned_ips)
src << "<font color=#f00>* ERROR - Connection Refused - IP Address is banned</font>"
return
if(computer_id in banned_pcs)
src << "<font color=#f00>* ERROR - Connection Refused - Computer ID is banned</font>"
return
for(var/mob/M)
if(M.client && M.client.computer_id == computer_id)
src << "<font color=#f00>* ERROR Detected a connection from your computer from another connected user</font>"
return
if(copytext(lowertext(key),1,7) == "guest-")
if(scfg["allow_guest_logins"]==1)
src << "- You are not logged in to BYOND, features will be restricted, and any options will not be saved"
var/mob/nwmob = new()
nwmob.name=key
nwmob.isguest=1
nwmob.key=key
else
src << "<font color=#f00>* ERROR This server does not allow guest logins</font>"
return
else
if(fexists("saves/users/[ckey].sav"))
var/mob/nwmob = new()
LoadUsrSave(nwmob,ckey)
nwmob.name=key
nwmob.gender=gender
nwmob.key=key
return ..()
client/Del()
clients--
return ..()
mob/Login()
cnct_ts = world.time
if(scfg["log_connections"]==1) WLog("connection","[key] logged in from ip [client.address]")
if(!(key in throttled)) throttled += key
if(clients > maxclients)
maxclients = clients
SaveMaxClients()
StatusMsg("info","<b>New Record!</b> Max clients connected is now [maxclients]")
ChatMsg("join","<b>--\> ([key])</b> has joined [world.name]",src)
loc=locate(1,1,1)
UpdateUserlist()
InitInterface()
spawn() AwayLoop()
spawn() FloodLoop()
StatusMsg1("info","Welcome [key]. Your host is [world.internet_address], running [world.name] version [GAME_VER], on BYOND version [world.byond_version].<br>This server has been running for [Duration(world.time)].")
mob/Logout()
if(scfg["log_connections"]==1) WLog("connection","[key] logged out")
SaveUsrSave()
ChatMsg("quit","<b>\<-- ([key])</b> has quit [world.name]",src)
UpdateUserlist()
del(src)
Expected Results:
Correct clients var which reflects current login count.
Actual Results:
clients var is too low indicating client/New() is sometimes failing.
Does the problem occur:
Every time? Or how often? Rarely
In other games? Untested
In other user accounts? Most likely
On other computers? Probably
When does the problem NOT occur?
Generally this is not a problem.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Untested.
Workarounds:
We could use the allusers list var in the updater as the for loop always seems to flect the accurate count. The var tracker is the issue.
Other Notes:
I absolutely hate reporting things I can't at least reproduce to a degree. I suspect this is maybe a packet issue causing client/New() to not fire but I can't prove anything.
I have tried to reproduce locally using guest account feature and autoit aid slamming 2 connections per second but it is always right on the money. This is a really frustrating issue.