Skip to content

Commit

Permalink
more consistent descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 21, 2011
1 parent d238b56 commit 90db3ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
25 changes: 10 additions & 15 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -50,10 +50,8 @@ sub connect {
weaken $client->{resolver};

# Events
$c->{close} = delete $args->{on_close} if $args->{on_close};
$c->{connect} = delete $args->{on_connect} if $args->{on_connect};
$c->{error} = delete $args->{on_error} if $args->{on_error};
$c->{read} = delete $args->{on_read} if $args->{on_read};
$c->{$_} = delete($args->{"on_$_"}) || $c->{$_}
for qw/close connect error read/;
weaken $self;
$client->on(
connect => sub {
Expand Down Expand Up @@ -269,12 +267,9 @@ sub start_tls {
my $id = shift;
my $args = ref $_[0] ? $_[0] : {@_};

# Steal handle and upgrade to TLS
my $stream = delete $self->{connections}->{$id}->{stream};
$args->{handle} = $stream->steal_handle;
$args->{id} = $id;
$args->{tls} = 1;
$self->connect($args);
# Steal handle and start TLS handshake
my $handle = delete($self->{connections}->{$id}->{stream})->steal_handle;
$self->connect({%$args, handle => $handle, id => $id, tls => 1});
}

sub stop {
Expand Down Expand Up @@ -426,7 +421,7 @@ Mojo::IOLoop - Minimalistic reactor for non-blocking TCP clients and servers
# Listen on port 3000
Mojo::IOLoop->listen(
port => 3000,
port => 3000,
on_read => sub {
my ($loop, $id, $chunk) = @_;
Expand All @@ -440,9 +435,9 @@ Mojo::IOLoop - Minimalistic reactor for non-blocking TCP clients and servers
# Connect to port 3000 with TLS activated
my $id = Mojo::IOLoop->connect(
address => 'localhost',
port => 3000,
tls => 1,
address => 'localhost',
port => 3000,
tls => 1,
on_connect => sub {
my ($loop, $id) = @_;
Expand Down Expand Up @@ -686,7 +681,7 @@ Note that this method is EXPERIMENTAL and might change without warning!
Drop anything with an id.
Connections will be dropped gracefully by allowing them to finish writing all
data in its write buffer.
data in their write buffer.
=head2 C<generate_port>
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server.pm
Expand Up @@ -104,7 +104,7 @@ L<Mojo::Server> can emit the following events.
my ($server, $tx) = @_;
});
Emitted for requests that need a response.
Emitted when a request is ready and needs to be handled.
$server->on(request => sub {
my ($server, $tx) = @_;
Expand Down

0 comments on commit 90db3ce

Please sign in to comment.