Skip to content

Commit

Permalink
Stylistic improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Juerd committed Feb 16, 2016
1 parent f664d26 commit 3facf99
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/MQTT/Client.pm
Expand Up @@ -41,7 +41,7 @@ method connect () {
return start {
use experimental :pack;

$!connection = await IO::Socket::Async.connect($!server, $!port);
$!connection = await IO::Socket::Async.connect: $!server, $!port;
my $packets = self!incoming-packets($!connection.Supply(:bin)).share;

$!messages = supply {
Expand Down Expand Up @@ -76,13 +76,14 @@ method !parse (Buf $buf is rw) {
my $multiplier = 1;
my $length = 0;
my $d = 0;
{
return if $offset >= $buf.elems;

repeat {
return False if $offset >= $buf.elems;
$d = $buf[$offset++];
$length += ($d +& 0x7f) * $multiplier;
$multiplier *= 128;
redo if $d +& 0x80;
}
} while $d +& 0x80;

return False if $length > $buf.elems + $offset;

my $first_byte = $buf[0];
Expand Down

0 comments on commit 3facf99

Please sign in to comment.