MP cache expiration re-worked to be time-dependent what allows an

unlimited number of pending request/responses in SNMP engine
pull/45/head
elie 2010-06-11 15:57:20 +00:00
parent c4709ed0e0
commit 20ef677c63
3 changed files with 8 additions and 7 deletions

View File

@ -19,8 +19,8 @@ Revision 4.1.14a
- config.addVacmUser() now accepts an optional contextName what makes
it usable for configuring multiple contextName-bound bases of Managed
Objects to SnmpEngine.
- Pending states cache management fixed so that SNMP engine will now handle
up to 1000 request/responses.
- MP pending states cache management re-worked so that SNMP engine will
now handle an unlimited number of pending request/responses.
Revision 4.1.13a
----------------

View File

@ -70,7 +70,7 @@ class AbstractMessageProcessingModel:
'Cache dup for stateReference=%s at %s' %
(stateReference, self)
)
expireAt = self.__expirationTimer+1000
expireAt = self.__expirationTimer+60
self.__stateReferenceIndex[stateReference] = ( msgInfo, expireAt )
# Schedule to expire
@ -79,7 +79,6 @@ class AbstractMessageProcessingModel:
if not self.__expirationQueue[expireAt].has_key('stateReference'):
self.__expirationQueue[expireAt]['stateReference'] = {}
self.__expirationQueue[expireAt]['stateReference'][stateReference] = 1
self.__expireCaches()
def _cachePopByStateRef(self, stateReference):
cacheInfo = self.__stateReferenceIndex.get(stateReference)
@ -106,7 +105,7 @@ class AbstractMessageProcessingModel:
raise error.ProtocolError(
'Cache dup for msgId=%s at %s' % (msgId, self)
)
expireAt = self.__expirationTimer+1000
expireAt = self.__expirationTimer+60
self.__msgIdIndex[msgId] = ( msgInfo, expireAt )
self.__sendPduHandleIdx[msgInfo['sendPduHandle']] = msgId
@ -117,7 +116,6 @@ class AbstractMessageProcessingModel:
if not self.__expirationQueue[expireAt].has_key('msgId'):
self.__expirationQueue[expireAt]['msgId'] = {}
self.__expirationQueue[expireAt]['msgId'][msgId] = 1
self.__expireCaches()
def _cachePopByMsgId(self, msgId):
cacheInfo = self.__msgIdIndex.get(msgId)
@ -156,4 +154,4 @@ class AbstractMessageProcessingModel:
pass # XXX maybe these should all follow some scheme?
def receiveTimerTick(self, snmpEngine, timeNow):
pass
self.__expireCaches()

View File

@ -744,3 +744,6 @@ class SnmpV3MessageProcessingModel(AbstractMessageProcessingModel):
def receiveTimerTick(self, snmpEngine, timeNow):
self.__expireEnginesInfo()
AbstractMessageProcessingModel.receiveTimerTick(
self, snmpEngine, timeNow
)