Skip to content

Commit

Permalink
PVA server earlier check of monitor window
Browse files Browse the repository at this point in the history
Check window size before attemting poll() as apparently
"spurious" send() is possible.
  • Loading branch information
mdavidsaver committed Oct 22, 2018
1 parent 3f85f7c commit f84774e
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/server/responseHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,17 @@ void ServerMonitorRequesterImpl::send(ByteBuffer* buffer, TransportSendControl*

// TODO asCheck ?

MonitorElement::Ref element(monitor);
bool busy = false;
if(_pipeline) {
Lock guard(_mutex);
busy = _window_open==0;
}

MonitorElement::Ref element;
if(!busy) {
MonitorElement::Ref E(monitor);
E.swap(element);
}
if (element)
{
control->startMessage((int8)CMD_MONITOR, sizeof(int32)/sizeof(int8) + 1);
Expand All @@ -2119,11 +2129,10 @@ void ServerMonitorRequesterImpl::send(ByteBuffer* buffer, TransportSendControl*
Lock guard(_mutex);
if(!_pipeline) {
} else if(_window_open==0) {
if(_pipeline) {
// Our logic has a problem, but try to continue.
message("Monitor Logic Error: send outside of window", epics::pvData::warningMessage);
LOG(logLevelError, "Monitor Logic Error: send outside of window %zu", _window_closed.size());
}
// This really shouldn't happen as the above ensures that _window_open *was* non-zero,
// and only we (the sender) will decrement.
message("Monitor Logic Error: send outside of window", epics::pvData::warningMessage);
LOG(logLevelError, "Monitor Logic Error: send outside of window %zu", _window_closed.size());

} else {
_window_closed.push_back(element.letGo());
Expand Down

0 comments on commit f84774e

Please sign in to comment.