Hi David,
On donderdag, jan 27, 2005, at 00:45 Europe/Amsterdam, David Davis
wrote:
Can I start a new session in client_input, start a new POE::Wheel::Run
from there *in* the ClientInput state? Or does that create a
(parent-child?) dependency with the POE::Component::Server::TCP
session? That runs sour when the client disconnects?
Yes it does create a wheel in that session handling the input for that
client.
Your session_stdout even is getting sent to that session, and you
don't have an event by that name in that session created by
Server::TCP.
Yes, this part I understand now :)
sub client_input
{
my ($session, $heap, $kernel, $input, $wheel) = @_[ SESSION, HEAP,
KERNEL, ARG0, ARG1 ];
## pass client's input and reference to our wheel
$kernel->post($heap->{controllingSession}, 'do_the_start', $input,
$heap->{client});
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 would be
better if you used $kernel->post($_[SENDER] => send => 'OK'); and
setup an inline_state called send that did a if ($heap->{client}) {
$heap->{client}->put($_[ARG0]); }
I tried it, seems to work fine.
You could also change this to a call() and be ok with using it as a
hack. Just don't pass wheel handles around freely.
I don't want a hack :)
I still don't understand what the "right" solution is though. I saw
something about detaching a session from it's parent as well. Maybe I
can create a session in the tcp server session, start the wheel in that
child session and then detach that session from the tcp server's
session. Sounds ok to me but I'm still not sure what the "right" way is.
Just don't pass wheel handles around freely.
Does that mean I can't pass the result of "POE::Wheel::Run->new(...)"
around as well? I have this:
my $child = new POE::Wheel::Run(....);
Then I keep the $child around so I can kill it later on. Is that bad?
Thanks,
Bas.
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|