| 1 | 2 | ▶ | use v5.44; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use experimental 'class'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | # The client's one membership of a channel, shared by every | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # BoardStreams::Client::Channel that the client has handed out for that | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # name. It talks to the server; the channels pass on what it receives. It | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # leaves the channel when the last of them has left. For internal use; a | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # port of the Membership class of the JavaScript client. | ||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | class BoardStreams::Client::Membership { | |||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | our $VERSION = "v0.0.60"; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Mojo::Util qw(generate_secret); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use RxPerl::Mojo qw(rx_behavior_subject rx_replay_subject rx_subject); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use Scalar::Util qw(refaddr); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use BoardStreams::Client::Channel; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use BoardStreams::Client::Error; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use BoardStreams::Diff qw(patch); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | field $name :param :reader; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | field $link :param; # { send => sub, forget => sub, reconnect => sub }, provided by the client | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | field $state_subject :reader = rx_replay_subject->new(1); | |||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | field $events_subject :reader = rx_subject->new; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 2 | field $gaps_subject :reader = rx_subject->new; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | field $status_subject :reader = rx_behavior_subject->new('joining'); | |||||||||||||||||||||||||||||||||||||||||
| 28 | 2 | field %channels; # the channel objects in use, by address | |||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | field @pending; # unconfirmed actions and requests, oldest first: { id, owner, message, resolve, reject } | |||||||||||||||||||||||||||||||||||||||||
| 30 | 2 | field @held; # responses waiting for their updates: { seq, owner, settle } | |||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | field $has_joined :reader = 0; # true once the first join has succeeded | |||||||||||||||||||||||||||||||||||||||||
| 32 | 2 | field $state :reader; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | field $seq; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 2 | field $live = 0; # true while joined on the current connection | |||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | # One more user of the channel. | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 38 | ▶ | method open { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 38 | my $channel = BoardStreams::Client::Channel->new(membership => $self); | |||||||||||||||||||||||||||||||||||||||||
| 39 | 38 | $channels{ refaddr $channel } = $channel; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 38 | return $channel; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | # One user of the channel is done with it. Its unanswered requests are | ||||||||||||||||||||||||||||||||||||||||||
| 44 | # rejected; its actions are still delivered. The last one to go takes | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # the client out of the channel. | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 7 | ▶ | method release ($channel, $error) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
release: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 7 | my $owner = refaddr $channel; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 7 | delete $channels{$owner}; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 7 | ▶ | my @rejected = grep { $_->{owner} == $owner and $_->{reject} } @pending; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$_->{'owner'} == $owner && $_->{'reject'}
MC/DC100%2/2
$_->{'owner'} == $owner && $_->{'reject'}
$_->{'owner'} == $owner
$_->{'reject'}
Truth table100%3/3
A && B
A= $_->{'owner'} == $ownerB= $_->{'reject'}
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 7 | ▶ | @pending = grep { !($_->{owner} == $owner and $_->{reject}) } @pending; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$_->{'owner'} == $owner && $_->{'reject'}
MC/DC100%2/2
$_->{'owner'} == $owner && $_->{'reject'}
$_->{'owner'} == $owner
$_->{'reject'}
Truth table100%3/3
A && B
A= $_->{'owner'} == $ownerB= $_->{'reject'}
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 7 | $_->{reject}->($error) for @rejected; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my @mine = grep { $_->{owner} == $owner } @held; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | @held = grep { $_->{owner} != $owner } @held; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 7 | $_->{settle}->() for @mine; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 7 | ▶ | $self->leave unless %channels; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 7 | return; | |||||||||||||||||||||||||||||||||||||||||
| 57 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | # Leaves the channel on the server, whoever still uses it. | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 21 | ▶ | method leave { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
leave: called CC=3 SCAR=11.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 21 | my $status = $status_subject->get_value; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 21 | ▶ | return if $status eq 'left' or $status eq 'rejected'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$status eq "left" or $status eq "rejected"
MC/DC0%0/2
$status eq "left" or $status eq "rejected"
$status eq "left"
$status eq "rejected"
Truth table33%1/3
A or B
A= $status eq "left"B= $status eq "rejected"
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 21 | $link->{send}->({ type => 'leave', channel => $name }); | |||||||||||||||||||||||||||||||||||||||||
| 64 | 21 | $self->_end('left', BoardStreams::Client::Error->new(reason => 'left')); | |||||||||||||||||||||||||||||||||||||||||
| 65 | 21 | return; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 30 | ▶ | method connected { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
connected: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 30 | ▶ | $link->{send}->({ type => 'join', channel => $name, (defined $seq ? (since => $seq) : ()) }); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 15 | ▶ | method disconnected { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disconnected: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 15 | $live = 0; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 15 | ▶ | $status_subject->next('joining') if $status_subject->get_value eq 'joined'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 6 | ▶ | method owns ($id) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
owns: called CC=3 SCAR=12.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 6 | ▶ | return 0 unless defined $id and !ref $id; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $id and not ref $id
MC/DC0%0/2
defined $id and not ref $id
defined $id
not ref $id
Truth table33%1/3
A and not(B)
A= defined $idB= not ref $id
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 6 | return scalar grep { $_->{id} eq $id } @pending; | |||||||||||||||||||||||||||||||||||||||||
| 80 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 45 | ▶ | method receive ($message) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
receive: called CC=18 SCAR=29.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 45 | ▶ | my $type = $message->{type} // ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$message->{"type"} // ""
MC/DC0%0/1
$message->{"type"} // ""
$message->{"type"}
Truth table50%1/2
A
A= $message->{"type"}
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 45 | ▶ | if ($type eq 'joined') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 18 | ▶ | if ($message->{updates}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 2 | $self->_apply($_) for $message->{updates}->@*; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 16 | $state = $message->{state}; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 16 | $seq = $message->{seq}; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 16 | $state_subject->next($state); | |||||||||||||||||||||||||||||||||||||||||
| 93 | 16 | ▶ | $gaps_subject->next(undef) if $message->{gap}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 18 | $live = 1; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 18 | $status_subject->next('joined'); | |||||||||||||||||||||||||||||||||||||||||
| 97 | 18 | $has_joined = 1; | |||||||||||||||||||||||||||||||||||||||||
| 98 | 18 | $_->_joined for values %channels; | |||||||||||||||||||||||||||||||||||||||||
| 99 | # Whatever was not confirmed before is sent (again); the server | ||||||||||||||||||||||||||||||||||||||||||
| 100 | # recognises repeats by their id. | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 18 | $link->{send}->($_->{message}) for @pending; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 18 | $self->_release; | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | elsif ($type eq 'update') { | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 10 | ▶ | return if !$live or !defined $seq or $message->{seq} <= $seq; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not $live && defined $seq or $message->{"seq"} <= $seq
$live && defined $seq
MC/DC33%1/3
not $live && defined $seq or $message->{"seq"} <= $seq
$live
defined $seq
$message->{"seq"} <= $seq
Truth table50%2/4
not(A && B) or C
A= $liveB= defined $seqC= $message->{"seq"} <= $seq
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | # An update was skipped; rejoining makes the server fill the hole. | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 9 | ▶ | return $link->{reconnect}->() if $message->{seq} != $seq + 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 8 | $self->_apply($message); | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | elsif ($type eq 'rejected') { | ||||||||||||||||||||||||||||||||||||||||||
| 111 | $self->_end('rejected', | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 12 | BoardStreams::Client::Error->new(reason => $message->{reason}, data => $message->{data})); | |||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | elsif ($type eq 'ack') { | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 1 | @pending = grep { $_->{id} ne $message->{id} } @pending; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | elsif ($type eq 'response') { | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 4 | ▶ | my ($answered) = grep { $_->{id} eq $message->{id} } @pending or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 4 | @pending = grep { $_->{id} ne $message->{id} } @pending; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 4 | ▶ | my $settle = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=15.2
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 4 | ▶ | return $answered->{resolve} && $answered->{resolve}->($message->{payload}) if $message->{ok}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$answered->{'resolve'} && $answered->{'resolve'}->($message->{'payload'})
MC/DC0%0/2
$answered->{'resolve'} && $answered->{'resolve'}->($message->{'payload'})
$answered->{'resolve'}
$answered->{'resolve'}->($message->{'payload'})
Truth table33%1/3
A && B
A= $answered->{'resolve'}B= $answered->{'resolve'}->($message->{'payload'})
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | $answered->{reject}->(BoardStreams::Client::Error->new( | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 1 | ▶ | reason => $message->{error}{reason}, data => $message->{error}{data})) if $answered->{reject}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 125 | # Hold the response until the updates it caused have been applied. | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 4 | ▶ | push @held, { seq => $message->{seq} // 0, owner => $answered->{owner}, settle => $settle }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$message->{"seq"} // 0
MC/DC0%0/1
$message->{"seq"} // 0
$message->{"seq"}
Truth table50%1/2
A
A= $message->{"seq"}
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 4 | $self->_release; | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 43 | return; | |||||||||||||||||||||||||||||||||||||||||
| 130 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 15 | ▶ | method submit ($channel, $type, $what, $payload, $resolve = undef, $reject = undef) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit: called CC=7 SCAR=22.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 15 | my $status = $status_subject->get_value; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 15 | ▶ | if ($status eq 'left' or $status eq 'rejected') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$status eq "left" or $status eq "rejected"
MC/DC0%0/2
$status eq "left" or $status eq "rejected"
$status eq "left"
$status eq "rejected"
Truth table33%1/3
A or B
A= $status eq "left"B= $status eq "rejected"
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | $reject->(BoardStreams::Client::Error->new(reason => $status)) if $reject; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 15 | my $id = substr generate_secret() =~ tr/A-Za-z0-9//cdr, 0, 32; | |||||||||||||||||||||||||||||||||||||||||
| 139 | 15 | my $message = { type => $type, channel => $name, id => $id, name => $what, payload => $payload }; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 15 | push @pending, { id => $id, owner => refaddr $channel, message => $message, resolve => $resolve, reject => $reject }; | |||||||||||||||||||||||||||||||||||||||||
| 141 | 15 | ▶ | $link->{send}->($message) if $live; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 10 | ▶ | method _apply ($update) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_apply: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 10 | ▶ | if ($update->{diff}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 6 | $state = patch($state, $update->{diff}); | |||||||||||||||||||||||||||||||||||||||||
| 147 | 6 | $state_subject->next($state); | |||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 10 | $seq = $update->{seq}; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 10 | $events_subject->next({ %$_, seq => $seq }) for $update->{events}->@*; | |||||||||||||||||||||||||||||||||||||||||
| 151 | 10 | $self->_release; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 32 | ▶ | method _release { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_release: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 32 | ▶ | my $reached = $seq // 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$seq // 0
MC/DC0%0/1
$seq // 0
$seq
Truth table50%1/2
A
A= $seq
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 32 | my @ready = grep { $_->{seq} <= $reached } @held; | |||||||||||||||||||||||||||||||||||||||||
| 157 | 32 | @held = grep { $_->{seq} > $reached } @held; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 32 | $_->{settle}->() for @ready; | |||||||||||||||||||||||||||||||||||||||||
| 159 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 33 | ▶ | method _end ($status, $error) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_end: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 33 | $live = 0; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 33 | $link->{forget}->(); | |||||||||||||||||||||||||||||||||||||||||
| 164 | 33 | my @channels = values %channels; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 33 | %channels = (); | |||||||||||||||||||||||||||||||||||||||||
| 166 | 33 | $_->_ended($status, $error) for @channels; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 33 | $status_subject->next($status); | |||||||||||||||||||||||||||||||||||||||||
| 168 | 33 | my @unanswered = splice @pending; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 33 | ▶ | $_->{reject} && $_->{reject}->($error) for @unanswered; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 33 | my @waiting = splice @held; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 33 | $_->{settle}->() for @waiting; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 33 | $_->_complete for @channels; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 33 | $_->complete for $state_subject, $events_subject, $gaps_subject, $status_subject; | |||||||||||||||||||||||||||||||||||||||||
| 174 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||