Skip to content

Commit

Permalink
documentation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 14, 2013
1 parent dfbd788 commit 6786e78
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/Headers.pm
Expand Up @@ -232,7 +232,7 @@ Shortcut for the C<Accept-Ranges> header.
$headers = $headers->add(Foo => 'first value', 'second value');
$headers = $headers->add(Foo => ['first line', 'second line']);
Add one or more header lines.
Add one or more header values with one or more lines.
=head2 authorization
Expand Down Expand Up @@ -344,7 +344,7 @@ Shortcut for the C<Expires> header.
$headers = $headers->from_hash({'Content-Type' => 'text/html'});
$headers = $headers->from_hash({});
Parse headers from a hash reference.
Parse headers from a hash reference, an empty hash removes all headers.
=head2 header
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojo/Server/Morbo.pm
Expand Up @@ -25,7 +25,7 @@ sub check_file {
sub run {
my ($self, $app) = @_;

# Prepare environment
# Clean manager environment
local $SIG{CHLD} = sub { $self->_reap };
local $SIG{INT} = local $SIG{TERM} = local $SIG{QUIT} = sub {
$self->{finished} = 1;
Expand All @@ -37,7 +37,6 @@ sub run {
# Prepare and cache listen sockets for smooth restarting
my $daemon = Mojo::Server::Daemon->new(silent => 1)->start->stop;

# Watch files and manage worker
$self->_manage while !$self->{finished} || $self->{running};
exit 0;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/Prefork.pm
Expand Up @@ -73,7 +73,7 @@ sub run {
$self->{pool}{shuffle keys %{$self->{pool}}}{graceful} ||= time;
};

# Preload application and start accepting connections
# Preload application before starting workers
$self->start->app->log->info("Manager $$ started.");
$self->{running} = 1;
$self->_manage while $self->{running};
Expand Down
14 changes: 7 additions & 7 deletions lib/Mojo/Transaction/HTTP.pm
Expand Up @@ -57,7 +57,7 @@ sub server_write { shift->_write(1) }
sub _body {
my ($self, $msg, $finish) = @_;

# Prepare chunk
# Prepare body chunk
my $buffer = $msg->get_body_chunk($self->{offset});
my $written = defined $buffer ? length $buffer : 0;
$self->{write} = $msg->is_dynamic ? 1 : ($self->{write} - $written);
Expand All @@ -80,13 +80,13 @@ sub _body {
sub _headers {
my ($self, $msg, $head) = @_;

# Prepare chunk
# Prepare header chunk
my $buffer = $msg->get_header_chunk($self->{offset});
my $written = defined $buffer ? length $buffer : 0;
$self->{write} = $self->{write} - $written;
$self->{offset} = $self->{offset} + $written;

# Write body
# Switch to body
if ($self->{write} <= 0) {
$self->{offset} = 0;

Expand All @@ -107,13 +107,13 @@ sub _headers {
sub _start_line {
my ($self, $msg) = @_;

# Prepare chunk
# Prepare start line chunk
my $buffer = $msg->get_start_line_chunk($self->{offset});
my $written = defined $buffer ? length $buffer : 0;
$self->{write} = $self->{write} - $written;
$self->{offset} = $self->{offset} + $written;

# Write headers
# Switch to headers
if ($self->{write} <= 0) {
$self->{state} = 'write_headers';
$self->{write} = $msg->header_size;
Expand All @@ -126,7 +126,7 @@ sub _start_line {
sub _write {
my ($self, $server) = @_;

# Start writing
# Nothing written yet
$self->{$_} ||= 0 for qw(offset write);
my $msg = $server ? $self->res : $self->req;
if ($server ? ($self->{state} eq 'write') : !$self->{state}) {
Expand All @@ -136,7 +136,7 @@ sub _write {
$headers->connection($self->keep_alive ? 'keep-alive' : 'close')
unless $headers->connection;

# Write start line
# Switch to start line
$self->{state} = 'write_start_line';
$self->{write} = $msg->start_line_size;
}
Expand Down
4 changes: 1 addition & 3 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -111,8 +111,6 @@ sub start {

# Non-blocking
if ($cb) {

# Start non-blocking
warn "-- Non-blocking request (@{[$tx->req->url->to_abs]})\n" if DEBUG;
unless ($self->{nb}) {
croak 'Blocking request in progress' if keys %{$self->{connections}};
Expand All @@ -123,7 +121,7 @@ sub start {
return $self->_start($tx, $cb);
}

# Start blocking
# Blocking
warn "-- Blocking request (@{[$tx->req->url->to_abs]})\n" if DEBUG;
if ($self->{nb}) {
croak 'Non-blocking requests in progress' if keys %{$self->{connections}};
Expand Down

0 comments on commit 6786e78

Please sign in to comment.