server monitor

This commit is contained in:
Michael Davidsaver
2020-01-16 19:44:54 -08:00
parent a1b9a64a06
commit c2a4224a21
12 changed files with 761 additions and 13 deletions
+12 -6
View File
@@ -100,9 +100,10 @@ struct ServerGPR : public ServerOp
auto self(it->second);
conn->opByIOID.erase(it);
conn->iface->server->acceptor_loop.dispatch([self](){
self->onClose("");
});
if(self->onClose)
conn->iface->server->acceptor_loop.dispatch([self](){
self->onClose("");
});
} else {
assert(false); // really shouldn't happen
@@ -336,15 +337,20 @@ void ServerConn::handle_GPR(pva_app_msg_t cmd)
} else if(chan->onOp) { // GET, PUT
chan->onOp(std::move(ctrl));
} else {
ctrl->error("Get/Put/RPC not implemented for this PV");
}
} else { // EXEC, maybe Get or Put
std::shared_ptr<ServerGPR> op;
auto it = opByIOID.find(ioid);
if(it==opByIOID.end() || !(op=std::dynamic_pointer_cast<ServerGPR>(it->second))) {
log_printf(connio, Err, "Client %s Gets %s IOID %u\n", peerName.c_str(),
it==opByIOID.end() ? "non-existant" : "invalid", unsigned(ioid));
if(it==opByIOID.end() || !(op=std::dynamic_pointer_cast<ServerGPR>(it->second))
|| op->state==ServerOp::Dead || op->state==ServerOp::Creating) {
log_printf(connio, Err, "Client %s Gets %s IOID %u state=%d\n", peerName.c_str(),
it==opByIOID.end() ? "non-existant" : "invalid", unsigned(ioid),
op ? op->state : ServerOp::Dead);
bev.reset();
return;
}