cwEuCon.cpp : Update heart-beat next recv time on every recvd msg.
This commit is contained in:
parent
09a02e9a9b
commit
83b588bbf8
18
cwEuCon.cpp
18
cwEuCon.cpp
@ -539,16 +539,9 @@ namespace cw
|
|||||||
fb->protoState = kRunning_Id;
|
fb->protoState = kRunning_Id;
|
||||||
// set the initial next heart-beat times for this fader bank
|
// set the initial next heart-beat times for this fader bank
|
||||||
time::futureMs(fb->nextSendHbTs,fb->eucon->heartBeatPeriodMs);
|
time::futureMs(fb->nextSendHbTs,fb->eucon->heartBeatPeriodMs);
|
||||||
time::futureMs(fb->nextRecvHbTs,fb->eucon->heartBeatPeriodMs*2);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kRunning_Id:
|
case kRunning_Id:
|
||||||
|
|
||||||
// if this is a heart-beat
|
|
||||||
if( ((uint8_t*)data)[0] == 0x03 )
|
|
||||||
time::futureMs(fb->nextRecvHbTs,fb->eucon->heartBeatPeriodMs+1000);
|
|
||||||
|
|
||||||
|
|
||||||
printf("%i : Rcv: %i : ",fb->fbIndex, dataByteCnt );
|
printf("%i : Rcv: %i : ",fb->fbIndex, dataByteCnt );
|
||||||
for(unsigned i=0; i<dataByteCnt; ++i)
|
for(unsigned i=0; i<dataByteCnt; ++i)
|
||||||
printf("0x%02x ",((uint8_t*)data)[i]);
|
printf("0x%02x ",((uint8_t*)data)[i]);
|
||||||
@ -556,6 +549,9 @@ namespace cw
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
time::futureMs(fb->nextRecvHbTs,fb->eucon->heartBeatPeriodMs+1000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc_t _on_McMix_DNS_SD_TXT( eucon_t* p, const char* numberText, unsigned numberTextCharN, const struct sockaddr_in* fromAddr )
|
rc_t _on_McMix_DNS_SD_TXT( eucon_t* p, const char* numberText, unsigned numberTextCharN, const struct sockaddr_in* fromAddr )
|
||||||
@ -624,8 +620,9 @@ namespace cw
|
|||||||
{
|
{
|
||||||
const char* name = (const char*)(u+6);
|
const char* name = (const char*)(u+6);
|
||||||
const char* label = "MC Mix - ";
|
const char* label = "MC Mix - ";
|
||||||
|
unsigned sn = strlen(label);
|
||||||
|
|
||||||
printf("%.*s|%i\n", name[0], name+1, strlen(label) );
|
printf("%.*s|%i\n", name[0], name+1, sn );
|
||||||
|
|
||||||
// if this a 'MC Mix' DNS-SD SRV reply
|
// if this a 'MC Mix' DNS-SD SRV reply
|
||||||
if( strncmp(label, name+1, strlen(label)) == 0 )
|
if( strncmp(label, name+1, strlen(label)) == 0 )
|
||||||
@ -736,17 +733,18 @@ cw::rc_t cw::eucon::exec( handle_t h, unsigned sockTimeOutMs )
|
|||||||
// get the current time
|
// get the current time
|
||||||
time::get(t0);
|
time::get(t0);
|
||||||
|
|
||||||
|
|
||||||
// check the health of each fader bank
|
// check the health of each fader bank
|
||||||
for(fbank_t* fb = p->fbankL; fb!=nullptr; fb=fb->link)
|
for(fbank_t* fb = p->fbankL; fb!=nullptr; fb=fb->link)
|
||||||
if( fb->protoState == kRunning_Id )
|
if( fb->protoState == kRunning_Id )
|
||||||
{
|
{
|
||||||
// has it been more than 'heartBeatPerioMs' millisecnods since we received a heart beat from this fader bank
|
|
||||||
|
// has it been more than 'heartBeatPerioMs' millisecnods since we received a msg from this fader bank
|
||||||
if( time::isGTE( t0, fb->nextRecvHbTs ) )
|
if( time::isGTE( t0, fb->nextRecvHbTs ) )
|
||||||
{
|
{
|
||||||
cwLogInfo("Missed heart-beat disconnecting fader bank index %i.",fb->fbIndex );
|
cwLogInfo("Missed heart-beat disconnecting fader bank index %i.",fb->fbIndex );
|
||||||
_disconnect(fb);
|
_disconnect(fb);
|
||||||
}
|
}
|
||||||
|
|
||||||
// is it time to send a heart-beat to this fader bank
|
// is it time to send a heart-beat to this fader bank
|
||||||
if( time::isGTE( t0, fb->nextSendHbTs ) )
|
if( time::isGTE( t0, fb->nextSendHbTs ) )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user