Skip to content

Commit

Permalink
no need to check the state as often
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 10, 2016
1 parent c17cda5 commit 065861e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions lib/Mojo/Channel/HTTP.pm
Expand Up @@ -9,10 +9,8 @@ sub write {
my $self = shift;

# Client starts writing right away
my $server = $self->is_server;
my $tx = $self->{tx};
$tx->{state} ||= 'write' unless $server;
return '' unless $tx->{state} eq 'write';
my $tx = $self->{tx};
$tx->{state} ||= 'write' unless my $server = $self->is_server;

# Nothing written yet
$tx->{$_} ||= 0 for qw(offset write);
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -104,9 +104,8 @@ sub send {
$self->{write} .= build_frame $self->masked, @$msg;
}
else { $self->{write} .= $self->build_message($msg) }
$self->{state} = 'write';

return $self->emit('resume');
return $self->SUPER::resume;
}

sub with_compression {
Expand Down

0 comments on commit 065861e

Please sign in to comment.