Weixin/Client/Remote/_synccheck.pm

filter: Statementstmt 4.7% 1 / 21 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 3.1% 1 / 32 CC 4 SCAR 22.6
CC
4
Cov
4%
_synccheck
12.0
__ANON__
6.0
CRAP 9.6
« Weixin/Cache.pm ↑ Summary Weixin/Plugin/UploadQRcode.pm »
1 0 ▶sub Mojo::Weixin::_synccheck{
Subroutine _synccheck: not called CC=3 SCAR=24.8
2 0 my $self = shift;
3 0 ▶ if($self->_sync_running or $self->_synccheck_running){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_sync_running or $self->_synccheck_running) 0 0 0
Condition0%0/3
$self->_sync_running or $self->_synccheck_running
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->_sync_running or $self->_synccheck_running
$self->_sync_running $self->_synccheck_running
Truth table0%0/3
A or B
A= $self->_sync_runningB= $self->_synccheck_running
ABresult
1X1
011
000
4 #$self->_synccheck_running(0);
5 0 $self->emit("synccheck_over",undef,undef,1);
6 0 $self->debug("消息处理程序进行中,避免重复运行(1)");
7 0 return;
8 }
9 0 $self->debug("检查消息(" . $self->_synccheck_interval . ")...");
10 0 $self->_synccheck_running(1);
11 0 my $api = "https://webpush.". $self->domain . "/cgi-bin/mmwebwx-bin/synccheck";
12 0 ▶ my $callback = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
13 0 my $data = shift;
14 #window.synccheck={retcode:"0",selector:"0"}
15 0 $self->_synccheck_running(0);
16 0 ▶ if(defined $data){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data) { } 0 0 0
17 0 my($retcode,$selector) = $data=~/window\.synccheck=\{retcode:"([^"]+)",selector:"([^"]+)"\}/g;
18 0 $self->emit("synccheck_over",$retcode,$selector,1);
19 }
20 else{
21 0 $self->emit("synccheck_over",undef,undef,0);
22 }
23 0 };
24 my @query_string = (
25 r => $self->now(),
26 skey => $self->skey,
27 sid => $self->wxsid,
28 uin => $self->wxuin,
29 deviceid => $self->deviceid,
30 0 synckey => join("|",map {$_->{Key} . "_" . $_->{Val};} @{$self->synccheck_key->{List}}),
31 _ => $self->now(),
32 );
33 0 my $id = $self->http_get($self->gen_url2($api,@query_string),{Referer=>"https://" .$self->domain . "/"},$callback);
34 0 $self->_synccheck_connection_id($id);
35 }
36 1 1;
« Weixin/Cache.pm ↑ Summary Weixin/Plugin/UploadQRcode.pm »