Replace some confusing Coro code in the PWP handshake test
commitbffe789b4a1310c5a6ade013fc4ea8510e95b1b8
authorJoshua Roys <roysjosh@gmail.com>
Mon, 19 May 2008 20:48:35 +0000 (19 16:48 -0400)
committerSam Vilain <sam@vilain.net>
Tue, 20 May 2008 07:28:12 +0000 (20 19:28 +1200)
tree66c82cde9cb6aa480e99839b17dd68606d69797b
parentc24dcdcd46de51c5f2eea6a1c1a8c0890cc4cdb5
Replace some confusing Coro code in the PWP handshake test

While setting up the two-node handshake test, as each node is running
in a separate Coro it is required that we let control pass from one
thread to the other during the test.  The way that this was previously
done was to just delay until the state was observed to change, but
this is not required - the message has been sent on the socket, and
the problem was that Coro was just not checking the socket for
messages with a simple "cede", as it had already been checked in the
last "sweep" of filehandles.

So, make t/50-pwp-handshake.t use Coro::Event::loop with a timeout
when the timeout is really required (on initial connection), and use
Coro::Event::sweep to mark the background threads as unchecked so that
the test can proceed directly.
t/50-pwp-handshake.t