Hi,

On vrijdag, jan 28, 2005, at 03:10 Europe/Amsterdam, Rocco Caputo wrote:

On Thu, Jan 27, 2005 at 12:40:56PM -0800, David Davis wrote:
Response below.

On Thu, 27 Jan 2005 20:15:22 +0100, Bas Schulte <[EMAIL PROTECTED]> wrote:
Hi David,

On donderdag, jan 27, 2005, at 00:45 Europe/Amsterdam, David Davis
wrote:

Don't pass the client wheel, that's bad when using post.

Argh. I don't understand why I can't pass the reference to the wheel though. Why is it bad?

It has to do with garbage collection. Wheels are linked to the session, and if you want to have it properly clean up and disconnect, don't pass it around.

Rocco, please chime in if I'm wrong.

Here's a previous message where I explained it:

http://aspn.activestate.com/ASPN/Mail/Message/2096709

In that message, it says this:

Rather, you create an event handler for your TCP connections.  The
handler accepts messages from the outside and transmits their payloads
from within the proper context.  It's as if the session has opened a
port through which data can enter its context.

(with some more explanation)

Right. There we have it :)

When the ClientInput state runs, it receives a command from the client, the (translated) command is sent to another session like this:

$kernel->post($heap->{controllingSession}, 'do_the_actual_start', $with_parameter_1, $and_parameter_2);

Then in the do_the_actual_start state, this gets the parameters:

sub controller_start
{
my ($kernel, $heap, $session, $parameter1, $parameter2) = @_[KERNEL, HEAP, SESSION, ARG0, ARG1];


   # do the POE::Wheel::Run thing here

   # And send response via client tcp session (the SENDER):

   $kernel->post($_[SENDER] => send_response => "OK");
}


Thanks all for the learning experience!

Cheers,

Bas.



Reply via email to