disconnect() calls a sysDisconnectEvent of it's own
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mudlet |
Opinion
|
Undecided
|
Unassigned |
Bug Description
Sample Code:
function doubleEcho()
cecho(
end
registerAnonymo
disconnect()
Explanation:
sysDisconnectEvent is designed to let you know that the connection to the MUD has been terminated. However, regardless of whether there is a connection to the MUD, calling the disconnect() function raises sysDisconnectEvent. When connected to a MUD, this results in sysDisconnectEvent being called twice if you manually run a disconnect(). If the MUD disconnects you on the other hand, you only get one sysDisconnectEvent, as proper.
Usually this is no problem. However, sometimes a function that is registered to sysDisconnectEvent will have issues if it is run twice. Other times you may not want said function to run unless already connected to the MUD when disconnect() is called.
IIRC we do not currently track the connection status properly - (there are unused variables associated with connection time-out and retries) - but I think it is something that does need to be done (for instance running a "replay" only really makes sense when "off-line" IMHO). Tracking such status details (and optionally providing that information to user or their scripts) would provide the information to properly handle the situation here, either internally or to allow scripts to handle it...