make reader send heartbeat packets.
This commit is contained in:
parent
24bb1b5508
commit
08bddb7b5f
|
@ -111,13 +111,13 @@ if($verbose){
|
||||||
};
|
};
|
||||||
my $lasttime=time;
|
my $lasttime=time;
|
||||||
my $llasttime=time;
|
my $llasttime=time;
|
||||||
my $pkt;
|
my ($type,$pkt);
|
||||||
my $donl=0;
|
my $donl=0;
|
||||||
|
|
||||||
my($typenick,$typebeacon,$typeunknown)=(0,0,0);
|
my($typenick,$typebeacon,$typeunknown)=(0,0,0);
|
||||||
my($ltypenick,$ltypebeacon,$ltypeunknown)=(0,0,0);
|
my($ltypenick,$ltypebeacon,$ltypeunknown)=(0,0,0);
|
||||||
while(1){
|
while(1){
|
||||||
$pkt=r0ket::get_packet();
|
($type,$pkt)=r0ket::get_data(0);
|
||||||
|
|
||||||
if($verbose){
|
if($verbose){
|
||||||
if(time-$lasttime >= $intvl){
|
if(time-$lasttime >= $intvl){
|
||||||
|
@ -145,7 +145,17 @@ while(1){
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
next if($pkt eq "ack"); # in-band signalling.
|
if($type==0){ # Read timeout -> Send Heartbeat.
|
||||||
|
$pkt= pack("CC13",
|
||||||
|
22, # proto (RFBPROTO_READER_ANNOUNCE)
|
||||||
|
0, # unused
|
||||||
|
);
|
||||||
|
$pkt.=pack("n",crcccitt($pkt));
|
||||||
|
# print "hb: len=",length($pkt),"\n";
|
||||||
|
}elsif($type!=1){
|
||||||
|
print "Unknown packet[type=$type]: $pkt\n";
|
||||||
|
};
|
||||||
|
|
||||||
if(length($pkt) != 16){ # Sanity check
|
if(length($pkt) != 16){ # Sanity check
|
||||||
$errors++;
|
$errors++;
|
||||||
next;
|
next;
|
||||||
|
@ -170,6 +180,7 @@ while(1){
|
||||||
send(SOCKET, $crc.$hdr.$pkt,0,$hispaddr);
|
send(SOCKET, $crc.$hdr.$pkt,0,$hispaddr);
|
||||||
|
|
||||||
next if($fast);
|
next if($fast);
|
||||||
|
next if($type==0); # skip hearbeat packets
|
||||||
|
|
||||||
my $p=r0ket::nice_beacon($pkt);
|
my $p=r0ket::nice_beacon($pkt);
|
||||||
if($p->{crc} ne "ok"){
|
if($p->{crc} ne "ok"){
|
||||||
|
|
Loading…
Reference in New Issue