def __init__(self, name, firstCheckDelay = None): Job.__init__(self, name) self._serialNum = serialNum() self._findContainersJob = None self._checkContainersJob = None self._pruneContainersJob = None if firstCheckDelay is None: firstCheckDelay = 60. * 15. # divide by two, since the first check just takes length measurements and # doesn't check for leaks self._nextCheckDelay = firstCheckDelay/2. self._checkDelayScale = config.GetFloat('leak-detector-check-delay-scale', 1.5) self._pruneTaskPeriod = config.GetFloat('leak-detector-prune-period', 60. * 30.) # main dict of id(container)->containerRef self._id2ref = {} # storage for results of check-container job self._index2containerId2len = {} self._index2delay = {} if config.GetBool('leak-container', 0): _createContainerLeak() if config.GetBool('leak-tasks', 0): _createTaskLeak() # don't check our own tables for leaks ContainerLeakDetector.addPrivateObj(ContainerLeakDetector.PrivateIds) ContainerLeakDetector.addPrivateObj(self.__dict__) self.setPriority(Job.Priorities.Min) jobMgr.add(self)
"""DistributedSmoothNode module: contains the DistributedSmoothNode class""" from pandac.PandaModules import * from .ClockDelta import * from . import DistributedNode from . import DistributedSmoothNodeBase from direct.task.Task import cont from direct.showbase import DConfig as config # This number defines our tolerance for out-of-sync telemetry packets. # If a packet appears to have originated from more than MaxFuture # seconds in the future, assume we're out of sync with the other # avatar and suggest a resync for both. MaxFuture = config.GetFloat("smooth-max-future", 0.2) # How frequently can we suggest a resynchronize with another client? MinSuggestResync = config.GetFloat("smooth-min-suggest-resync", 15) # These flags indicate whether global smoothing and/or prediction is # allowed or disallowed. EnableSmoothing = config.GetBool("smooth-enable-smoothing", 1) EnablePrediction = config.GetBool("smooth-enable-prediction", 1) # These values represent the amount of time, in seconds, to delay the # apparent position of other avatars, when non-predictive and # predictive smoothing is in effect, respectively. This is in # addition to the automatic delay of the observed average latency from # each avatar, which is intended to compensate for relative clock # skew. Lag = config.GetDouble("smooth-lag", 0.2) PredictionLag = config.GetDouble("smooth-prediction-lag", 0.0)