Skip to content

Commit

Permalink
Mojo::Channel::HTTP::Server needs a start method too
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 10, 2016
1 parent 74f436f commit d3f3b91
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/Channel/HTTP.pm
Expand Up @@ -8,7 +8,7 @@ sub is_server {undef}
sub start {
my $self = shift;
@$self{qw(tx cb)} = @_;
delete @$self{qw(delay handled http_state offset write)};
delete @$self{qw(delay http_state offset write)};
return $self;
}

Expand Down
6 changes: 6 additions & 0 deletions lib/Mojo/Channel/HTTP/Server.pm
Expand Up @@ -16,4 +16,10 @@ sub read {
$tx->handle if $req->is_finished && !$self->{handled}++;
}

sub start {
my $self = shift;
delete $self->{handled};
return $self->SUPER::start(@_);
}

1;
4 changes: 1 addition & 3 deletions lib/Mojo/Server/Daemon.pm
Expand Up @@ -206,9 +206,7 @@ sub _read {

# Make sure we have a transaction and parse chunk
my $c = $self->{connections}{$id};
unless ($c->{tx}) {
$c->start($self->_build_tx($id, $c));
}
$c->start($self->_build_tx($id, $c)) unless $c->{tx};
my $tx = $c->{tx};
warn term_escape "-- Server <<< Client (@{[_url($tx)]})\n$chunk\n" if DEBUG;
$c->read($chunk);
Expand Down

0 comments on commit d3f3b91

Please sign in to comment.