Skip to content
Snippets Groups Projects
Commit 9cc8a091 authored by Jonathan Hanks's avatar Jonathan Hanks
Browse files

Daqds configured as a gds broadcaster have a different channel hash.

The broadcast daqds modify their channel list to mark only the broadcast channels as active/acquired.  This is what they should do, but it means a straight hash of the channel list creates a different channel hash than the other daqds.  This fix calculates the channel hash two ways, one w/o modification, and one w/ the broadcast list explicitly ignored.  This will all the broadcast daqd to declare that it has the same base channel hash (before applying the broadcast list to the channel list) as other daqds and will allow gds broadcasters to have their broadcast list checked as well.

Move the hashing from the start main handler to the channels begin/end handler.  Add a {PREFIX}CHANNEL_LIST_CHECK_SUM_BCAST pv to show the channel hash after processing for the broadcast list.  On non-broadcast daqds these will be identical to the {PREFIX}CHANNEL_LIST_CHECK_SUM pv.
parent 246848be
No related branches found
No related tags found
1 merge request!161Daqd channel hash with broadcast
......@@ -10,6 +10,7 @@
#include "config.h"
#include "daqd.hh"
#include "checksum_crc32.hh"
extern daqd_c daqd;
......@@ -30,10 +31,17 @@ namespace comm_impl
exit( 1 );
int cur_dcu = -1;
// compute the checksum of the channels two ways
// the broadcaster mode uses a different set of active channels
// which changes the channel hash with respect to the other daqds.
// So to help compare state this computes two hashes, one that
// all daqds will see and one with the broadcast settings.
checksum_crc32 csum;
checksum_crc32 csum_bcast;
// Save channel offsets and assign trend channel data struct
for ( i = 0, offs = 0; i < daqd.num_channels + 1; i++ )
{
int active_before_bcast_check = 0;
int t = 0;
if ( i == daqd.num_channels )
t = 1;
......@@ -129,6 +137,7 @@ namespace comm_impl
}
}
active_before_bcast_check = daqd.channels[ i ].active;
if ( !daqd.broadcast_set.empty( ) )
{
// Activate configured DMT broadcast channels
......@@ -165,7 +174,19 @@ namespace comm_impl
daqd.trender.num_channels++;
}
}
// the unmodified hash, this differs between
// broadcasters and all other daqds
hash_channel( csum_bcast, daqd.channels[ i ] );
{
// 'undo' the potential broadcast change to create
// the 'normal' channel hash.
channel_t tmp = daqd.channels[ i ];
tmp.active = active_before_bcast_check;
hash_channel( csum, tmp );
}
}
PV::set_pv( PV::PV_CHANNEL_LIST_CHECK_SUM, csum.result( ) );
PV::set_pv( PV::PV_CHANNEL_LIST_CHECK_SUM_BCAST, csum_bcast.result( ) );
if ( !daqd.broadcast_set.empty( ) )
{
......
......@@ -1533,14 +1533,6 @@ daqd_c::start_main( int pmain_buffer_size, ostream* yyout )
/* Epics display: memory buffer look back */
PV::set_pv( PV::PV_LOOKBACK_RAM, main_buffer_size );
checksum_crc32 csum;
const channel_t* cur = channels;
const channel_t* end = cur + num_channels;
std::for_each( cur, end, [&csum]( const channel_t& channel ) {
hash_channel( csum, channel );
} );
PV::set_pv( PV::PV_CHANNEL_LIST_CHECK_SUM, csum.result( ) );
return 0;
}
......
......@@ -41,6 +41,7 @@ namespace PV
PV_MINUTE_FRAME_SIZE,
PV_RETRANSMIT_TOTAL,
PV_CHANNEL_LIST_CHECK_SUM,
PV_CHANNEL_LIST_CHECK_SUM_BCAST,
// DCU counts
PV_PRDCR_UNIQUE_DCU_REPORTED_PER_S,
PV_PRDCR_TOTAL_DCU_REPORTED_PER_S,
......
......@@ -234,6 +234,13 @@ pvInfo exServer::pvList[] = {
excasIoSync,
1,
pvValue + PV::PV_CHANNEL_LIST_CHECK_SUM ),
pvInfo( 1,
"PV_CHANNEL_LIST_CHECK_SUM_BCAST",
0xffffffff,
0,
excasIoSync,
1,
pvValue + PV::PV_CHANNEL_LIST_CHECK_SUM_BCAST ),
pvInfo( 1,
"PRDCR_UNIQUE_DCU_REPORTED_PER_S",
0xffffffff,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment