print debug if verboseRepository

This commit is contained in:
Darren Ranalli 2007-02-22 00:40:27 +00:00
parent aa9e13efe1
commit 0ad3bac423

View File

@ -113,6 +113,9 @@ class DoInterestManager(DirectObject.DirectObject):
self._completeEventCount = ScratchPad(num=0) self._completeEventCount = ScratchPad(num=0)
self._allInterestsCompleteCallbacks = [] self._allInterestsCompleteCallbacks = []
def __verbose(self):
return self.InterestDebug or self.getVerbose()
def _getAnonymousEvent(self, desc): def _getAnonymousEvent(self, desc):
return 'anonymous-%s-%s' % (desc, DoInterestManager._SerialGen.next()) return 'anonymous-%s-%s' % (desc, DoInterestManager._SerialGen.next())
@ -181,8 +184,8 @@ class DoInterestManager(DirectObject.DirectObject):
event = self._getAnonymousEvent('addInterest') event = self._getAnonymousEvent('addInterest')
DoInterestManager._interests[handle] = InterestState( DoInterestManager._interests[handle] = InterestState(
description, InterestState.StateActive, scopeId, event, parentId, zoneIdList, self._completeEventCount) description, InterestState.StateActive, scopeId, event, parentId, zoneIdList, self._completeEventCount)
if self.InterestDebug: if self.__verbose():
print 'INTEREST DEBUG: addInterest(): handle=%s, parent=%s, zoneIds=%s, description=%s, event=%s, auto=%s' % ( print 'CR::INTEREST.addInterest(handle=%s, parentId=%s, zoneIdList=%s, description=%s, event=%s, auto=%s)' % (
handle, parentId, zoneIdList, description, event, auto) handle, parentId, zoneIdList, description, event, auto)
if not auto: if not auto:
self._sendAddInterest(handle, scopeId, parentId, zoneIdList, description) self._sendAddInterest(handle, scopeId, parentId, zoneIdList, description)
@ -234,9 +237,9 @@ class DoInterestManager(DirectObject.DirectObject):
self._sendRemoveInterest(handle, scopeId) self._sendRemoveInterest(handle, scopeId)
if event is None: if event is None:
self._considerRemoveInterest(handle) self._considerRemoveInterest(handle)
if self.InterestDebug: if self.__verbose():
print 'INTEREST DEBUG: removeInterest(): handle=%s, event=%s' % ( print 'CR::INTEREST.removeInterest(handle=%s, event=%s, auto=%s)' % (
handle, event) handle, event, auto)
else: else:
DoInterestManager.notify.warning( DoInterestManager.notify.warning(
"removeInterest: handle not found: %s" % (handle)) "removeInterest: handle not found: %s" % (handle))
@ -279,8 +282,8 @@ class DoInterestManager(DirectObject.DirectObject):
DoInterestManager._interests[handle].zoneIdList = zoneIdList DoInterestManager._interests[handle].zoneIdList = zoneIdList
DoInterestManager._interests[handle].addEvent(event) DoInterestManager._interests[handle].addEvent(event)
if self.InterestDebug: if self.__verbose():
print 'INTEREST DEBUG: alterInterest(): handle=%s, parent=%s, zoneIds=%s, description=%s, event=%s' % ( print 'CR::INTEREST.alterInterest(handle=%s, parentId=%s, zoneIdList=%s, description=%s, event=%s)' % (
handle, parentId, zoneIdList, description, event) handle, parentId, zoneIdList, description, event)
self._sendAddInterest(handle, scopeId, parentId, zoneIdList, description, action='modify') self._sendAddInterest(handle, scopeId, parentId, zoneIdList, description, action='modify')
exists = True exists = True
@ -470,8 +473,8 @@ class DoInterestManager(DirectObject.DirectObject):
assert DoInterestManager.notify.debugCall() assert DoInterestManager.notify.debugCall()
handle = di.getUint16() handle = di.getUint16()
scopeId = di.getUint32() scopeId = di.getUint32()
if self.InterestDebug: if self.__verbose():
print 'INTEREST DEBUG: interestDone(): handle=%s' % handle print 'CR::INTEREST.interestDone(handle=%s)' % handle
DoInterestManager.notify.debug( DoInterestManager.notify.debug(
"handleInterestDoneMessage--> Received handle %s, scope %s" % ( "handleInterestDoneMessage--> Received handle %s, scope %s" % (
handle, scopeId)) handle, scopeId))
@ -507,10 +510,10 @@ class DoInterestManager(DirectObject.DirectObject):
callback() callback()
self._allInterestsCompleteCallbacks = [] self._allInterestsCompleteCallbacks = []
self.cleanupWaitAllInterestsClosed() self.cleanupWaitAllInterestsClosed()
self._completeDelayedCallback = FrameDelayedCallback( self._completeDelayedCallback = FrameDelayedCall(
'waitForAllInterestCompletes', 'waitForAllInterestCompletes',
frames=3,
callback=sendEvent, callback=sendEvent,
frames=3,
cancelFunc=checkMoreInterests) cancelFunc=checkMoreInterests)
checkMoreInterests = None checkMoreInterests = None
sendEvent = None sendEvent = None