Skip to content

Commit

Permalink
fixed small argument bug in client method of Mojo::IOLoop
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Dec 18, 2011
1 parent abbe257 commit 5a7b9ae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -2,6 +2,7 @@ This file documents the revision history for Perl extension Mojolicious.

2.39 2011-12-18 00:00:00
- Improved documentation. (vervain, sri)
- Fixed small argument bug in client method of Mojo::IOLoop.

2.38 2011-12-17 00:00:00
- Changed Mojo::IOLoop->client arguments from ($loop, $stream, $err)
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/IOLoop.pm
Expand Up @@ -63,7 +63,7 @@ sub client {
$client->on(
error => sub {
my $c = delete $self->{connections}->{$id};
$self->$cb(pop);
$self->$cb(pop, undef);
}
);

Expand Down
1 change: 1 addition & 0 deletions t/mojo/ioloop.t
Expand Up @@ -179,6 +179,7 @@ $err = undef;
$loop->client(
(port => $port) => sub {
shift->stop;
pop;
$err = pop;
}
);
Expand Down
9 changes: 5 additions & 4 deletions t/mojo/ioloop_tls.t
Expand Up @@ -115,7 +115,7 @@ $id = $loop->client(
tls => 1,
tls_cert => 't/mojo/certs/badcert.key',
tls_key => 't/mojo/certs/badcert.crt',
sub { $client_error = pop }
sub { shift; $client_error = shift }
);
$loop->timer(1 => sub { shift->stop });
$loop->start;
Expand All @@ -142,7 +142,7 @@ $id = $loop->client(
tls => 1,
tls_cert => 't/mojo/certs/client.crt',
tls_key => 't/mojo/certs/client.key',
sub { $client_error = pop }
sub { shift; $client_error = shift }
);
$loop->timer(1 => sub { shift->stop });
$loop->start;
Expand Down Expand Up @@ -190,7 +190,8 @@ is $client_close, 1, 'client emitted close event once';

# Missing client certificate
$server_error = $client_error = '';
$id = $loop->client({port => $port, tls => 1} => sub { $client_error = pop });
$id = $loop->client(
{port => $port, tls => 1} => sub { shift; $client_error = shift });
$loop->timer(1 => sub { shift->stop });
$loop->start;
ok !$server_error, 'no error';
Expand Down Expand Up @@ -218,7 +219,7 @@ $id = $loop->client(
tls => 1,
tls_cert => 't/mojo/certs/client.crt',
tls_key => 't/mojo/certs/client.key',
sub { $client_error = pop }
sub { shift; $client_error = shift }
);
$loop->timer(1 => sub { shift->stop });
$loop->start;
Expand Down

0 comments on commit 5a7b9ae

Please sign in to comment.