Author Topic: TCPObject's onDisconnect not working properly when using .disconnect()  (Read 626 times)

This was working fine literally a day or so ago, and now it isn't. I have absolutely no idea why, and I've tried on a vanilla installation.

TCPObject::onDisconnect is not being called when I disconnect the TCPObject manually via TCPObject.disconnect();.

If the connection times out, though, for example, onDisconnect is called.

Code: [Select]
==>new TCPObject(h);
==>function h::onConnected(%this){echo("connect");}
==>function h::onDisconnect(%this){echo("disconnect");}
==>h.connect("blockland.us:80");
connect
==>h.disconnect();
==>h.connect("blockland.us:80");
connect
disconnect

Is there something goofy I'm missing here?

Nope, just call it manually if you want to.

This is mainly intended behavior. Just do this:

function h::disconnect(%this)
{
  Parent::disconnect(%this);
  %this.onDisconnect();
}


(doesn't need to be in a package)