Browse files

0.1007 is in the can

  • Loading branch information...
1 parent b79f2dc commit de98f3988694536a401d2a2c92ca85149f5ae25c @rcaputo committed Jun 8, 2000
Showing with 57 additions and 26 deletions.
  1. +30 −10 Changes
  2. +1 −1 lib/POE.pm
  3. +0 −4 lib/POE/Kernel.pm
  4. +19 −3 lib/POE/Wheel/SocketFactory.pm
  5. +4 −0 mylib/coverage.perl
  6. +2 −2 tests/09_wheels_unix.t
  7. +1 −6 tests/12_signals_ev.t
View
40 Changes
@@ -16,15 +16,11 @@ subversions are available from <http://www.newts.org/~troc/poe.html>.
,----- To Do -----
|
-| Next
-|
-| Event doesn't seem very fast; am I using it incorrectly?
-|
| Before 0.11
|
-| Test $kernel->fork()
+| Test $kernel->fork() or replace it entirely.
|
-| Turn SocketFactory's sample program into a test case.
+| Test SocketFactory with UDP sockets.
|
| After 0.11
|
@@ -34,9 +30,33 @@ subversions are available from <http://www.newts.org/~troc/poe.html>.
`-----------------
-0.1006 2000.??.?? (!!!)
+0.1007 2000.06.07
+-----------------
+
+Version 0.1006 was put on the web site, but ignatz found a bug in
+SocketFactory that prevented t/09_wheels_unix.t from passing on
+Linux machines. a-mused confirmed that the problem appears on Linux
+but not Solaris. My own FreeBSD system was not affected. The bug
+relates to calling getpeername on UNIX domain sockets. The resulting
+unpack_sockaddr_un call would fail when getpeername returned an
+undefined (not undef) value. The failing code is now wrapped in
+eval, and it will gracefully recover from this sort of error.
+
+Many thanks to ignatz and a-mused for quick testing, and to Fletch
+for verifying that 0.1007 works on RedHat 6.2 x86!
+
+
+0.1006 2000.06.07 (!!!)
-----------------------
+This version was placed on the web site, but a-mused and ignatz found
+bugs SocketFactory right away. As a result, I held off announcing it
+to the mailing list until a fix could be included.
+
+Added t/12_signals_ev.t to test Event's SIGCHLD handler. It's pretty
+much the same as t/11_signals_poe.t, but using Event or skipping itself
+if Event is not available.
+
Increased the time that t/11_signals_poe.t waits to reap children. On
memory- and cpu-challenged systems, swap times could delay process
exits, causing false failures when the test program timed out.
@@ -49,9 +69,9 @@ greatly reduces the amount of work done in POE's stock $SIG{CHLD}
handlers which in turn reduces the probability that SIGCHLD will
segfault Perl. Note, however, that the chance of this occurring will
remain nonzero as long as Perl is not signal safe. (Also, the patch
-wouldn't apply and I sort of redid the code as I spliced the idea into
-the Kernel. It's probably busted, and I should compare it against
-Philip's original patch to make sure it works the way he intended.)
+wouldn't apply and I sort of redid the code as I spliced it into the
+the Kernel. I'll know when Philip tests it whether I've broken his
+algorithm.)
Tweaked postbacks. Older Perl versions were not doing the right
things with \@_ in POE::Session's postback() method. Replaced it
View
2 lib/POE.pm
@@ -7,7 +7,7 @@ use strict;
use Carp;
use vars qw($VERSION);
-$VERSION = 0.1006;
+$VERSION = 0.1007;
sub import {
my $self = shift;
View
4 lib/POE/Kernel.pm
@@ -1571,8 +1571,6 @@ sub _tk_select_callback {
sub _event_fifo_callback {
my $self = $poe_kernel;
-warn "fifo callback";
-
{% dispatch_one_from_fifo %}
# Stop the idle watcher if there are no more state transitions in
@@ -1653,8 +1651,6 @@ sub _invoke_state {
if ($state eq EN_SCPOLL) {
-warn $state;
-
# Non-blocking wait for a child process. If one was reaped,
# dispatch a SIGCHLD to the session who called fork.
View
22 lib/POE/Wheel/SocketFactory.pm
@@ -153,9 +153,23 @@ sub _define_connect_state {
my $peer = getpeername($handle);
my ($peer_addr, $peer_port);
+ # getpeername's return value in undefined for unbound peer
+ # sockets in the Unix domain. Take precautions against
+ # evil undefined behavior.
+
if ($domain eq DOM_UNIX) {
- $peer_addr = unpack_sockaddr_un($peer);
- $peer_port = undef;
+ $peer_addr = $peer_port = undef;
+ if (defined $peer) {
+ eval {
+ $peer_addr = unpack_sockaddr_un($peer);
+ };
+ if ($@) {
+ $peer_addr = undef;
+ }
+ }
+ else {
+ $peer_addr = undef;
+ }
}
elsif ($domain eq DOM_INET) {
($peer_port, $peer_addr) = unpack_sockaddr_in($peer);
@@ -895,7 +909,9 @@ For INET sockets, ARG1 and ARG2 hold the socket's remote address and
port, respectively.
For Unix client sockets, ARG1 contains the server address and ARG2 is
-undefined.
+undefined. Some systems have trouble getting the address of a socket's
+remote end, so ARG1 may be undefined if there was trouble determining
+it.
According to _Perl Cookbook_, the remote address for accepted Unix
domain sockets is undefined. So ARG0 and ARG1 are, too.
View
4 mylib/coverage.perl
@@ -29,6 +29,8 @@
# Run each test with coverage statistics.
+goto SPANG;
+
foreach my $test_file (@test_files) {
unlink "$test_file.coverage";
@@ -40,6 +42,8 @@
}
}
+SPANG:
+
# Combine coverage statistics across all files.
foreach my $test_file (@test_files) {
View
4 tests/09_wheels_unix.t
@@ -93,7 +93,7 @@ sub server_unix_start {
unlink $unix_server_socket if -e $unix_server_socket;
$heap->{wheel} = POE::Wheel::SocketFactory->new
- ( SocketDomain => AF_UNIX,
+ ( SocketDomain => PF_UNIX,
BindAddress => $unix_server_socket,
SuccessState => 'got_client',
FailureState => 'got_error',
@@ -141,7 +141,7 @@ sub client_unix_start {
my $heap = $_[HEAP];
$heap->{wheel} = POE::Wheel::SocketFactory->new
- ( SocketDomain => AF_UNIX,
+ ( SocketDomain => PF_UNIX,
RemoteAddress => $unix_server_socket,
SuccessState => 'got_server',
FailureState => 'got_error',
View
7 tests/12_signals_ev.t
@@ -18,7 +18,6 @@ BEGIN {
# Turn on all asserts.
sub POE::Kernel::ASSERT_DEFAULT () { 1 }
-sub POE::Kernel::TRACE_DEFAULT () { 1 }
use POE;
&test_setup(2);
@@ -34,7 +33,7 @@ eval {
import Time::HiRes qw(time sleep);
};
-my $fork_count = 1;
+my $fork_count = 16;
# Set up a signal catching session. This test uses plain fork(2) and
# POE's $SIG{CHLD} handler.
@@ -58,7 +57,6 @@ POE::Session->create
}
else {
sleep $wake_time - time();
-warn "child $$ exits";
dump;
}
}
@@ -79,7 +77,6 @@ warn "child $$ exits";
_stop =>
sub {
- warn "stop";
my $heap = $_[HEAP];
if ($heap->{reaped} == $fork_count) {
print "ok 2\n";
@@ -91,14 +88,12 @@ warn "child $$ exits";
catch_sigchld =>
sub {
- warn "sigchld";
$_[HEAP]->{reaped}++;
$_[KERNEL]->delay( time_is_up => 15 );
},
time_is_up =>
sub {
- warn "time is up";
# do nothing, really
},
},

0 comments on commit de98f39

Please sign in to comment.