Skip to content

Commit

Permalink
local is more elegant
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 28, 2016
1 parent 1bfe20d commit 2e52faf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

6.43 2016-01-27
6.43 2016-01-28
- Removed client_close and server_close methods from Mojo::Transaction.
- Added closed method to Mojo::Transaction.
- Added parse_message method to Mojo::Transaction::WebSocket.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Server/Daemon.pm
Expand Up @@ -227,9 +227,9 @@ sub _write {

# Protect from resume event recursion
my $c = $self->{connections}{$id};
return if !(my $tx = $c->{tx}) || $c->{writing}++;
return if !(my $tx = $c->{tx}) || $c->{writing};
local $c->{writing} = 1;
my $chunk = $tx->server_write;
delete $c->{writing};
warn term_escape "-- Server >>> Client (@{[_url($tx)]})\n$chunk\n" if DEBUG;
my $next = $tx->is_finished ? '_finish' : $chunk eq '' ? undef : '_write';
return $self->ioloop->stream($id)->write($chunk) unless $next;
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -317,9 +317,9 @@ sub _write {

# Protect from resume event recursion
my $c = $self->{connections}{$id};
return if !(my $tx = $c->{tx}) || $c->{writing}++;
return if !(my $tx = $c->{tx}) || $c->{writing};
local $c->{writing} = 1;
my $chunk = $tx->client_write;
delete $c->{writing};
warn term_escape "-- Client >>> Server (@{[_url($tx)]})\n$chunk\n" if DEBUG;
return if $chunk eq '';
weaken $self;
Expand Down

0 comments on commit 2e52faf

Please sign in to comment.