Panda3D
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ConnectionRepository Class Reference
Inheritance diagram for ConnectionRepository:
DoInterestManager DoCollectionManager ClientRepositoryBase ClientRepository OldClientRepository

Public Member Functions

def __init__ (self, connectMethod, config, hasOwnerView=False, threadedNet=None)
 
def checkHttp (self)
 
def connect (self, serverList, successCallback=None, successArgs=[], failureCallback=None, failureArgs=[])
 
def disconnect (self)
 
def generateGlobalObject (self, doId, dcname, values=None)
 
def getServerAddress (self)
 
def handleDatagram (self, di)
 
def handleReaderOverflow (self)
 
def httpConnectCallback (self, ch, serverList, serverIndex, successCallback, successArgs, failureCallback, failureArgs)
 
def importModule (self, dcImports, moduleName, importSymbols)
 
def lostConnection (self)
 
def readDCFile (self, dcFileNames=None)
 
def readerPollOnce (self)
 
def readerPollUntilEmpty (self, task)
 
def send (self, datagram)
 
def shutdown (self)
 
def startReaderPollTask (self)
 
def stopReaderPollTask (self)
 
- Public Member Functions inherited from DoInterestManager
def __init__ (self)
 
def addAutoInterest (self, parentId, zoneIdList, description)
 
def addInterest (self, parentId, zoneIdList, description, event=None)
 
def alterInterest (self, handle, parentId, zoneIdList, description=None, event=None)
 
def cleanupWaitAllInterestsComplete (self)
 
def closeAutoInterests (self, obj)
 
def getAllInterestsCompleteEvent (self)
 
def handleInterestDoneMessage (self, di)
 
def isValidInterestHandle (self, handle)
 
def noNewInterests (self)
 
def openAutoInterests (self, obj)
 
def printInterestHistory (self)
 
def printInterests (self)
 
def printInterestSets (self)
 
def printInterestsIfDebug (self)
 
def queueAllInterestsCompleteEvent (self, frames=5)
 
def removeAIInterest (self, handle)
 
def removeAutoInterest (self, handle)
 
def removeInterest (self, handle, event=None)
 
def resetInterestStateForConnectionLoss (self)
 
def setAllInterestsCompleteCallback (self, callback)
 
def setNoNewInterests (self, flag)
 
def updateInterestDescription (self, handle, desc)
 
- Public Member Functions inherited from DoCollectionManager
def __init__ (self)
 
def addDOToTables (self, do, location=None, ownerView=False)
 
def callbackWithDo (self, doId, callback)
 
def callbackWithOwnerView (self, doId, callback)
 
def countObjects (self, classType)
 
def deleteDistributedObjects (self)
 
def deleteObjectLocation (self, object, parentId, zoneId)
 
def doByDistance (self)
 
def doFind (self, str)
 
def doFindAll (self, str)
 
def doFindAllInstances (self, cls)
 
def doFindAllMatching (self, str)
 
def doFindAllOfType (self, query)
 
def dosByDistance (self)
 
def findAnyOfType (self, type)
 
def getAllOfType (self, type)
 
def getDo (self, doId)
 
def getDoIdList (self, parentId, zoneId=None, classType=None)
 
def getDoList (self, parentId, zoneId=None, classType=None)
 
def getDoTable (self, ownerView)
 
def getGameDoId (self)
 
def getObjectsInZone (self, parentId, zoneId)
 def changeDOZoneInTables(self, do, newParentId, newZoneId, oldParentId, oldZoneId): if 1: self.storeObjectLocation(do.doId, newParentId, newZoneId) else: #assert not hasattr(do, "isQueryAllResponse") or not do.isQueryAllResponse oldLocation = (oldParentId, oldZoneId) newLocation = (newParentId, newZoneId)

HACK: DistributedGuildMemberUD starts in -1, -1, which isnt ever put in the

zoneId2doIds table

if self.isValidLocationTuple(oldLocation): assert self.notify.debugStateCall(self) assert oldLocation in self.zoneId2doIds assert do.doId in self.zoneId2doIds[oldLocation] assert do.doId not in self.zoneId2doIds.get(newLocation, {})

remove from old zone

del(self.zoneId2doIds[oldLocation][do.doId]) if len(self.zoneId2doIds[oldLocation]) == 0: del self.zoneId2doIds[oldLocation] if self.isValidLocationTuple(newLocation):

add to new zone

self.zoneId2doIds.setdefault(newLocation, {}) self.zoneId2doIds[newLocation][do.doId]=do More...
 
def getObjectsOfClassInZone (self, parentId, zoneId, objClass)
 
def getOwnerView (self, doId)
 
def getOwnerViewDoIdList (self, classType)
 
def getOwnerViewDoList (self, classType)
 
def handleObjectLocation (self, di)
 
def handleSetLocation (self, di)
 
def hasOwnerViewDoId (self, doId)
 
def isInDoTables (self, doId)
 
def isValidLocationTuple (self, location)
 
def printObjectCount (self)
 
def printObjects (self)
 
def removeDOFromTables (self, do)
 
def storeObjectLocation (self, object, parentId, zoneId)
 
def webPrintObjectCount (self)
 

Public Attributes

 bootedIndex
 if self.recorder and self.recorder.isPlaying(): More...
 
 bootedText
 
 config
 
 connectHttp
 
 connectMethod
 
 dclassesByName
 
 dclassesByNumber
 
 dcSuffix
 
 hashVal
 
 http
 
 private__di
 
 readerPollTaskObj
 
 recorder
 
 uniqueId
 
- Public Attributes inherited from DoCollectionManager
 doId2do
 
 doId2ownerView
 self.zoneId2doIds={} More...
 

Static Public Attributes

int CM_HTTP = 0
 
int CM_NATIVE = 2
 
int CM_NET = 1
 
string GarbageCollectTaskName = "allowGarbageCollect"
 
string GarbageThresholdTaskName = "adjustGarbageCollectThreshold"
 
 gcNotify = directNotify.newCategory("GarbageCollect")
 
 notify = DirectNotifyGlobal.directNotify.newCategory("ConnectionRepository")
 
 taskChain = None
 
int taskPriority = -30
 
- Static Public Attributes inherited from DoInterestManager
 dConfigParam
 
 InterestDebug = tempbase.config.GetBool('interest-debug', False)
 
 notify = directNotify.newCategory("DoInterestManager")
 
 tempbase = base
 
 types
 

Detailed Description

This is a base class for things that know how to establish a
connection (and exchange datagrams) with a gameserver.  This
includes ClientRepository and AIRepository.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  connectMethod,
  config,
  hasOwnerView = False,
  threadedNet = None 
)

Member Function Documentation

◆ checkHttp()

def checkHttp (   self)

◆ connect()

def connect (   self,
  serverList,
  successCallback = None,
  successArgs = [],
  failureCallback = None,
  failureArgs = [] 
)
Attempts to establish a connection to the server.  May return
before the connection is established.  The two callbacks
represent the two functions to call (and their arguments) on
success or failure, respectively.  The failure callback also
gets one additional parameter, which will be passed in first:
the return status code giving reason for failure, if it is
known.

◆ disconnect()

def disconnect (   self)
Closes the previously-established connection.

◆ generateGlobalObject()

def generateGlobalObject (   self,
  doId,
  dcname,
  values = None 
)

◆ getServerAddress()

def getServerAddress (   self)

◆ handleDatagram()

def handleDatagram (   self,
  di 
)

◆ handleReaderOverflow()

def handleReaderOverflow (   self)

◆ httpConnectCallback()

def httpConnectCallback (   self,
  ch,
  serverList,
  serverIndex,
  successCallback,
  successArgs,
  failureCallback,
  failureArgs 
)

◆ importModule()

def importModule (   self,
  dcImports,
  moduleName,
  importSymbols 
)
Imports the indicated moduleName and all of its symbols
into the current namespace.  This more-or-less reimplements
the Python import command.

◆ lostConnection()

def lostConnection (   self)

◆ readDCFile()

def readDCFile (   self,
  dcFileNames = None 
)
Reads in the dc files listed in dcFileNames, or if
dcFileNames is None, reads in all of the dc files listed in
the Config.prc file.

◆ readerPollOnce()

def readerPollOnce (   self)

◆ readerPollUntilEmpty()

def readerPollUntilEmpty (   self,
  task 
)

◆ send()

def send (   self,
  datagram 
)

◆ shutdown()

def shutdown (   self)

◆ startReaderPollTask()

def startReaderPollTask (   self)

◆ stopReaderPollTask()

def stopReaderPollTask (   self)

Member Data Documentation

◆ bootedIndex

bootedIndex

if self.recorder and self.recorder.isPlaying():

If we have a recorder and it's already in playback mode,

don't actually attempt to connect to a gameserver since

we don't need to. Just let it play back the data.

self.notify.info("Not connecting to gameserver; using playback data instead.") self.connectHttp = 1 self.tcpConn = SocketStreamRecorder() self.recorder.addRecorder('gameserver', self.tcpConn) self.startReaderPollTask() if successCallback: successCallback(*successArgs) return

◆ bootedText

bootedText

◆ CM_HTTP

int CM_HTTP = 0
static

◆ CM_NATIVE

int CM_NATIVE = 2
static

◆ CM_NET

int CM_NET = 1
static

◆ config

config

◆ connectHttp

connectHttp

◆ connectMethod

connectMethod

◆ dclassesByName

dclassesByName

◆ dclassesByNumber

dclassesByNumber

◆ dcSuffix

dcSuffix

◆ GarbageCollectTaskName

string GarbageCollectTaskName = "allowGarbageCollect"
static

◆ GarbageThresholdTaskName

string GarbageThresholdTaskName = "adjustGarbageCollectThreshold"
static

◆ gcNotify

gcNotify = directNotify.newCategory("GarbageCollect")
static

◆ hashVal

hashVal

◆ http

http

◆ notify

notify = DirectNotifyGlobal.directNotify.newCategory("ConnectionRepository")
static

◆ private__di

private__di

◆ readerPollTaskObj

readerPollTaskObj

◆ recorder

recorder

◆ taskChain

taskChain = None
static

◆ taskPriority

int taskPriority = -30
static

◆ uniqueId

uniqueId