← Back to team overview

mudlet-makers team mailing list archive

[Bug 1676955] [NEW] disconnect() calls a sysDisconnectEvent of it's own

 

Public bug reported:

Sample Code:

function doubleEcho()
  cecho("\n<black:yellow>This will echo twice, but only if currently connected to the MUD when disconenct() is called")
end

registerAnonymousEventHandler("sysDisconnectionEvent","doubleEcho")

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.

** Affects: mudlet
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Mudlet
Makers, which is subscribed to Mudlet.
https://bugs.launchpad.net/bugs/1676955

Title:
  disconnect() calls a sysDisconnectEvent of it's own

Status in Mudlet:
  New

Bug description:
  Sample Code:

  function doubleEcho()
    cecho("\n<black:yellow>This will echo twice, but only if currently connected to the MUD when disconenct() is called")
  end

  registerAnonymousEventHandler("sysDisconnectionEvent","doubleEcho")

  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mudlet/+bug/1676955/+subscriptions


Follow ups