As some of you have noticed, POE::Component::OSCAR, a module that allows
you to use Net::OSCAR with POE, doesn't always work.

During some head-scratching, I noticed that it worked most of the time
on a 500MHz machine but always failed on a 2.0GHz box.  On a whim, I
added a "sleep 1" to a section of the code on the faster machine, and lo
and behold everything worked fine.

I've been digging into things ever since, but am afraid I've reached the
limits of my socket/POE/Net::OSCAR/interaction understanding.  I'll
continue to play with it, but if anyone else feels like joining the
fray, I'd be grateful.  Details of what I've found so far follow.

With the Net::OSCAR debug level at (10, 1), the successful login looks
like this:

(mybot) login: Connecting to login.oscar.aol.com:5190.
(mybot) login: Connected.
(mybot) login: Getting connack.
(mybot) login: Got '
          2A 01 95 BC  00 04                                      *...
..'
(mybot) login: Got '
          00 00 00 01                                             ....'
(mybot) login: Got
(mybot) login: Got connack.
(mybot) login: Got connack.  Sending connack.
...

The unsuccessful, like this:

(mybot) login: Connecting to login.oscar.aol.com:5190.
(mybot) login: Connected.
(mybot) login: Getting connack.
(mybot) login: Got connack.
(mybot) login: Closing.
(mybot) login: Put ''

Tracing through Net::OSCAR::Connection.pm, it looks like after the
"Getting connack" message both attempts call the line 

my $flap = $self->flap_get();

in process_one().  From there, flap_get() tries to get the header in the
line 

my $header = $self->read(6);

And in read(), the line 

my $nchars = sysread($self->{socket}, $buffer, $self->{buffsize} -
length($self->{buffer}));

returns 6 for the successful attempt and 0 for the unsuccessful.

Presumbaly, the faster machine is calling process_one() before the
header has arrived in the buffer.  So I figure the solution revolves
around getting POE and Net::OSCAR to either wait to perform the read or
re-try it after the first attempts returns nothing.

If anyone has any suggestions on how to proceed, please let me know.

Thanks,
Dan

Reply via email to