in reply to Re: Telling POE to ignore a filehandle for garbage collection purposes?
in thread Telling POE to ignore a filehandle for garbage collection purposes?
You don't send a _stop event. POE generates a _stop event to indicate that a session is terminating.
Not seeing any code, my best guess would be to implement an idle timer on worker socket. I've done this in the past, by storing a time stamp using time() in the heap in a POE::Wheel::ReadWrite's InputEvent handler and FlushedEvent handler. Then have a delayed event that periodically wakes up and checks the time stamp against the current time and takes appropriate action.
sub _start_wheel { # we've started our wheel and stashed it in the heap. # let's start a delayed event. $kernel->delay( '_wheel_alarm', 60 ); return; } sub _input_handler { # deal with input $heap->{timestamp} = time(); return; } sub _flushed_handler { # Looks like we sent some stuff $heap->{timestamp} = time(); return; } sub _wheel_alarm { my ($kernel,$heap) = @_[KERNEL,HEAP]; # ding dong if ( time() - $heap->{timestamp} > 300 ) { delete $heap->{socket_wheel}; # remove the socket } else { $kernel->delay( '_wheel_alarm', 60 ); } return; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Telling POE to ignore a filehandle for garbage collection purposes?
by jasonk (Parson) on Mar 18, 2008 at 16:53 UTC |