pvalink add retry: option

allow put to be queued on a disconnected channel
This commit is contained in:
Michael Davidsaver
2018-04-19 15:21:02 -07:00
parent af761958e5
commit e70aa0897d
3 changed files with 10 additions and 3 deletions

View File

@ -78,7 +78,7 @@ struct pvaLinkConfig : public jlink
MSI,
} ms;
bool defer, pipeline, time;
bool defer, pipeline, time, retry;
int monorder;
// internals used by jlif parsing

View File

@ -15,6 +15,7 @@ pvaLinkConfig::pvaLinkConfig()
,defer(false)
,pipeline(false)
,time(false)
,retry(false)
,monorder(0)
{}
pvaLinkConfig::~pvaLinkConfig() {}
@ -38,6 +39,7 @@ using namespace pvalink;
* "time":true, // false, true
* "monorder":#,// order of processing during CP scan
* "defer":true,// whether to immediately start Put, or only queue value to be sent
* "retry":true,// queue Put while disconnected, and retry on connect
* }
*/
@ -104,6 +106,8 @@ jlif_result pva_parse_bool(jlink *pjlink, int val)
pvt->pipeline = !!val;
} else if(pvt->jkey == "time") {
pvt->time = !!val;
} else if(pvt->jkey == "retry") {
pvt->retry = !!val;
} else if(pvt->debug) {
printf("pva link parsing unknown integer depth=%u key=\"%s\" value=%s\n",
pvt->parseDepth, pvt->jkey.c_str(), val ? "true" : "false");

View File

@ -378,8 +378,7 @@ long pvaPutValue(DBLINK *plink, short dbrType,
if(nRequest < 0) return -1;
if(!self->valid()) {
// TODO: option to queue while disconnected
if(!self->retry && !self->valid()) {
return -1;
}
@ -422,6 +421,10 @@ void pvaScanForward(DBLINK *plink)
TRACE(<<plink->precord->name<<" "<<self->channelName);
Guard G(self->lchan->lock);
if(!self->retry && !self->valid()) {
return;
}
// FWD_LINK is never deferred, and always results in a Put
self->lchan->put(true);
}CATCH(pvaIsConnected)