diff --git a/lib/POE/Component/SSLify.pm b/lib/POE/Component/SSLify.pm index 11aeac2..47f2292 100644 --- a/lib/POE/Component/SSLify.pm +++ b/lib/POE/Component/SSLify.pm @@ -83,7 +83,7 @@ $socket = Client_SSLify( $socket, undef, undef, $ctx ); NOTE: You can pass the callback anywhere in the arguments, we'll figure it out for you! If you want to call a POE event, please look -into the postback/callback stuff in POE::Session. +into the postback/callback stuff in L. $socket = Client_SSLify( $socket, $session->callback( 'got_connect' => @args ) ); @@ -402,10 +402,11 @@ =func SSLify_GetStatus -Returns the status of the SSL negotiation/handshake/connection. +Returns the status of the SSL negotiation/handshake/connection. See L +for more info. my $status = SSLify_GetStatus( $socket ); - -1 = still in negotiation stage + -1 = still in negotiation stage ( or error ) 0 = internal SSL error, connection will be dead 1 = negotiation successful =cut diff --git a/t/4_connect_hook.t b/t/4_connect_hook.t index c279597..4bb1887 100644 --- a/t/4_connect_hook.t +++ b/t/4_connect_hook.t @@ -54,7 +54,7 @@ my $socket = eval { Server_SSLify( $_[ARG0], sub { my( $socket, $status, $errval ) = @_; - pass( "SERVER: Got connect hook" ); + pass( "SERVER: Got callback hook" ); is( $status, 'OK', "SERVER: Status received from callback is OK" ); ## At this point, connection MUST be encrypted. @@ -104,7 +104,7 @@ my $socket = eval { Client_SSLify($_[ARG0], sub { my( $socket, $status, $errval ) = @_; - pass( "CLIENT: Got connect hook" ); + pass( "CLIENT: Got callback hook" ); is( $status, 'OK', "CLIENT: Status received from callback is OK" ); ## At this point, connection MUST be encrypted. diff --git a/t/5_connfail_client.t b/t/5_connfail_client.t index fa3e956..9bb7692 100644 --- a/t/5_connfail_client.t +++ b/t/5_connfail_client.t @@ -86,9 +86,8 @@ my $socket = eval { Client_SSLify($_[ARG0], sub { my( $socket, $status, $errval ) = @_; - pass( "CLIENT: Got connect hook" ); + pass( "CLIENT: Got callback hook" ); is( $status, 'ERR', "CLIENT: Status received from callback is ERR - $errval" ); - is( SSLify_GetStatus( $socket ), 0, "CLIENT: SSLify_GetStatus is error" ); $poe_kernel->post( 'myclient' => 'shutdown' ); }) }; diff --git a/t/6_connfail_server.t b/t/6_connfail_server.t index 3ad2769..fe07048 100644 --- a/t/6_connfail_server.t +++ b/t/6_connfail_server.t @@ -49,9 +49,8 @@ my $socket = eval { Server_SSLify( $_[ARG0], sub { my( $socket, $status, $errval ) = @_; - pass( "SERVER: Got connect hook" ); + pass( "SERVER: Got callback hook" ); is( $status, 'ERR', "SERVER: Status received from callback is ERR - $errval" ); - is( SSLify_GetStatus( $socket ), 0, "SERVER: SSLify_GetStatus is error" ); $poe_kernel->post( 'myserver' => 'shutdown'); } ) }; @@ -112,10 +111,13 @@ # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; + # Since this test purposefully sends garbage, we expect a connection reset by peer + # not ok 7 - Got SERVER read error 104: Connection reset by peer + # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; - unless ( $syscall eq 'read' and $errno == 0 ) { + unless ( $syscall eq 'read' and $errno == 104 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE};