On Sat, Aug 23, 2003 at 04:04:26PM -0400, Dan McCormick wrote:
>
[...]
>
> Furthermore, tracing through POE's guts, when we call
> $kernel->select($socket) in rd_ok or wr_ok with an invalid socket, it
> ends up at _data_handle_remove, in which the second line that calls
> fileno($handle) returns undef.  Meanwhile, a look at %kr_filenos
> indicates that fileno 3 is still there.

This is a complex issue.  I originally was going to suggest replacing
the fileno($handle) call with something like

  my $fd = fileno $handle;
  $fh = $handle unless defined $fd;

but it dawned on me that a single file descriptor can be represented by
multiple file handles.

So for _data_handle_remove(), we'd need something based on descriptor
that removes the file selectors for all associated handles.

> So somehow we need (a) Net::OSCAR to alert POE that it's closing the
> socket or (b) POE to stop watching an invalid filehandle.
> 
> Happily, there's a Net::OSCAR callback that we can set up to alert us 
> before it closes a connection.  The only hitch is that using a
> $session->postback seems to give us the socket too late --
> $connection->{socket} is already undef.
> 
> But if I make it a straight subroutine call, everything works fine. 
> (Which raises the question: has there been talk of a synchronous
> "$session->callback()"?)

Not until today. :)  If you look at the postback() code in POE::Session,
it should be straightforward to build a callback() version.  Copy,
paste, s/post/call/ throughout the new sub.

Test it against Net::OSCAR, and submit a patch if it works.  A
documentation patch would also be appreciated.

> In any case, the PoCo::Net::OSCAR module is now fully functional and
> perhaps even well-coded.  I'll post it on the Wiki shortly.
> 
> Thanks for the guidance, Rocco.

I'm glad I could help.  Consider releasing it to the CPAN, too.  I think
more people will find it at the CPAN than on the wiki.

-- 
Rocco Caputo - [EMAIL PROTECTED] - http://poe.perl.org/

Reply via email to