get_request called twice
Frank Fock
Frank.Fock____t-online.de
Wed Nov 8 21:52:30 CET 2000
Guy.HINDELL____opentrade.co.uk wrote:
> I've recently implemented a leaf derived from MibLeaf which overrides the
> get_value() method with some code which performs rather more processing than
> the simple return of a varbind. I noticed whilst debugging this code that it
> was being invoked twice for each get request I sent to the agent, which is
> an overhead I don't want.
>
Then you should not override get_value(), instead please override
get_request(Request*, int).
>
> One problem with this is that get_request can't be overridden in derived
> leaf classes (I don't do this anyway), but maybe another approach is an
> additional get_reqest method which can take a varbind as an argument rather
> than call get_value.
The get_request method can be overridden! The only thing
you will have to make sure is that it looks like:
void MibLeaf::get_request(Request* req, int ind)
{
if (get_access() >= READONLY) {
Mib::requestList->done(req->get_transaction_id(), ind,
get_value());
}
else {
Mib::requestList->error(req->get_transaction_id(), ind,
SNMP_ERROR_NO_ACCESS);
}
}
Best regards,
Frank
--
Frank Fock - AGENT++
Email: frank____fock.de
Fax: +49 7195 177108
More information about the AGENTPP
mailing list