Skip to content

Commit

Permalink
no need to write twice
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 27, 2016
1 parent 455e66e commit 299b8b5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -321,12 +321,9 @@ sub _write {
my $chunk = $tx->client_write;
delete $c->{writing};
warn term_escape "-- Client >>> Server (@{[_url($tx)]})\n$chunk\n" if DEBUG;
my $stream = $c->{ioloop}->stream($id)->write($chunk);

# Continue writing
return if $chunk eq '';
weaken $self;
$stream->write('' => sub { $self->_write($id) });
$c->{ioloop}->stream($id)->write($chunk => sub { $self->_write($id) });
}

1;
Expand Down

0 comments on commit 299b8b5

Please sign in to comment.