Panda3D
Loading...
Searching...
No Matches
ConnectionRepository Class Reference
Inheritance diagram for ConnectionRepository:
DoInterestManager DoCollectionManager DirectObject ClientRepositoryBase ClientRepository

Public Member Functions

 __init__ (self, connectMethod, config, hasOwnerView=False, threadedNet=None)
 
 checkHttp (self)
 
 connect (self, serverList, successCallback=None, successArgs=[], failureCallback=None, failureArgs=[])
 
 disconnect (self)
 
 generateGlobalObject (self, doId, dcname, values=None)
 
 getServerAddress (self)
 
 handleDatagram (self, di)
 
 handleReaderOverflow (self)
 
 httpConnectCallback (self, ch, serverList, serverIndex, successCallback, successArgs, failureCallback, failureArgs)
 
 importModule (self, dcImports, moduleName, importSymbols)
 
 lostConnection (self)
 
 readDCFile (self, dcFileNames=None)
 
 readerPollOnce (self)
 
 readerPollUntilEmpty (self, task)
 
 send (self, datagram)
 
 shutdown (self)
 
 startReaderPollTask (self)
 
 stopReaderPollTask (self)
 
- Public Member Functions inherited from DoInterestManager
 __init__ (self)
 
 addAutoInterest (self, parentId, zoneIdList, description)
 
 addInterest (self, parentId, zoneIdList, description, event=None)
 
 alterInterest (self, handle, parentId, zoneIdList, description=None, event=None)
 
 cleanupWaitAllInterestsComplete (self)
 
 closeAutoInterests (self, obj)
 
 getAllInterestsCompleteEvent (self)
 
 handleInterestDoneMessage (self, di)
 
 isValidInterestHandle (self, handle)
 
 noNewInterests (self)
 
 openAutoInterests (self, obj)
 
 printInterestHistory (self)
 
 printInterests (self)
 
 printInterestSets (self)
 
 printInterestsIfDebug (self)
 
 queueAllInterestsCompleteEvent (self, frames=5)
 
 removeAIInterest (self, handle)
 
 removeAutoInterest (self, handle)
 
 removeInterest (self, handle, event=None)
 
 resetInterestStateForConnectionLoss (self)
 
 setAllInterestsCompleteCallback (self, callback)
 
 setNoNewInterests (self, flag)
 
 updateInterestDescription (self, handle, desc)
 
- Public Member Functions inherited from DirectObject
 __init__ (self)
 
 accept (self, event, method, extraArgs=[])
 
 acceptOnce (self, event, method, extraArgs=[])
 
 addTask (self, *args, **kwargs)
 
 detectLeaks (self)
 
 doMethodLater (self, *args, **kwargs)
 
 getAllAccepting (self)
 
 ignore (self, event)
 
 ignoreAll (self)
 
 isAccepting (self, event)
 
 isIgnoring (self, event)
 
 removeAllTasks (self)
 
 removeTask (self, taskOrName)
 
- Public Member Functions inherited from DoCollectionManager
 __init__ (self)
 
 addDOToTables (self, do, location=None, ownerView=False)
 
 callbackWithDo (self, doId, callback)
 
 callbackWithOwnerView (self, doId, callback)
 
 countObjects (self, classType)
 
 deleteDistributedObjects (self)
 
 deleteObjectLocation (self, object, parentId, zoneId)
 
 doByDistance (self)
 
 doFind (self, str)
 
 doFindAll (self, str)
 
 doFindAllInstances (self, cls)
 
 doFindAllMatching (self, str)
 
 doFindAllOfType (self, query)
 
 dosByDistance (self)
 
 findAnyOfType (self, type)
 
 getAllOfType (self, type)
 
 getDo (self, doId)
 
 getDoIdList (self, parentId, zoneId=None, classType=None)
 
 getDoList (self, parentId, zoneId=None, classType=None)
 
 getDoTable (self, ownerView)
 
 getGameDoId (self)
 
 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)
 
 getObjectsOfClassInZone (self, parentId, zoneId, objClass)
 
 getOwnerView (self, doId)
 
 getOwnerViewDoIdList (self, classType)
 
 getOwnerViewDoList (self, classType)
 
 handleObjectLocation (self, di)
 
 handleSetLocation (self, di)
 
 hasOwnerViewDoId (self, doId)
 
 isInDoTables (self, doId)
 
 isValidLocationTuple (self, location)
 
 printObjectCount (self)
 
 printObjects (self)
 
 removeDOFromTables (self, do)
 
 storeObjectLocation (self, object, parentId, zoneId)
 
 webPrintObjectCount (self)
 

Public Attributes

 bootedIndex = None
 
 bootedText = None
 
 config = config
 
 connectHttp = None
 
int connectMethod = connectMethod
 
dict dclassesByName = {}
 
dict dclassesByNumber = {}
 
str dcSuffix = ''
 
 handleReaderOverflow
 
int hashVal = 0
 
 http = None
 
 lostConnection
 
 private__di = PyDatagramIterator()
 
 readerPollTaskObj = None
 
 recorder = None
 
 uniqueId = hash(self)
 
- Public Attributes inherited from DoCollectionManager
dict doId2do = {}
 location = do.getLocation() if location is not None: if location not in self.zoneId2doIds: self.notify.warning( 'dobj s (s) has invalid location: s' % (do, do.doId, location)) else: assert do.doId in self.zoneId2doIds[location] del self.zoneId2doIds[location][do.doId] if len(self.zoneId2doIds[location]) == 0: del self.zoneId2doIds[location]
 
dict doId2ownerView = {}
 self.zoneId2doIds={}
 
 getDo
 

Static Public Attributes

int CM_HTTP = 0
 
int CM_NATIVE = 2
 
int CM_NET = 1
 
str GarbageCollectTaskName = "allowGarbageCollect"
 
str GarbageThresholdTaskName = "adjustGarbageCollectThreshold"
 
 gcNotify = directNotify.newCategory("GarbageCollect")
 
 taskChain = None
 
int taskPriority = -30
 
- Static Public Attributes inherited from DoInterestManager
 InterestDebug = ConfigVariableBool('interest-debug', False)
 
 notify = directNotify.newCategory("DoInterestManager")
 
- Static Public Attributes inherited from DirectObject
 accept_once = acceptOnce
 
 add_task = addTask
 
 detect_leaks = detectLeaks
 
 do_method_later = doMethodLater
 
 get_all_accepting = getAllAccepting
 
 ignore_all = ignoreAll
 
 is_accepting = isAccepting
 
 is_ignoring = isIgnoring
 
 remove_all_tasks = removeAllTasks
 
 remove_task = removeTask
 

Protected Member Functions

 _adjustGcThreshold (self, task)
 
 _garbageCollect (self, task=None)
 
 _getLostConnectionEvent (self)
 
- Protected Member Functions inherited from DoInterestManager
 _addDebugInterestHistory (self, action, description, handle, contextId, parentId, zoneIdList)
 
 _considerRemoveInterest (self, handle)
 
 _getAddInterestEvent (self)
 
 _getAnonymousEvent (self, desc)
 
 _getInterestState (self, handle)
 
 _getNextContextId (self)
 
 _getNextHandle (self)
 
 _getRemoveInterestEvent (self)
 
 _sendAddInterest (self, handle, contextId, parentId, zoneIdList, description, action=None)
 
 _sendRemoveAIInterest (self, handle)
 
 _sendRemoveInterest (self, handle, contextId)
 
- Protected Member Functions inherited from DirectObject
 _addTask (self, task)
 
 _clearTask (self, task)
 
- Protected Member Functions inherited from DoCollectionManager
 _compareDistance (self, do1, do2)
 
 _getDistanceFromLA (self, do)
 
 _printObjects (self, table)
 
 _returnObjects (self, table)
 

Protected Attributes

 _adjustGcThreshold
 
 _garbageCollect
 
 _gcDefaultThreshold = gc.get_threshold()
 
str _serverAddress = ''
 
- Protected Attributes inherited from DoInterestManager
 _addInterestEvent = uniqueName('DoInterestManager-Add')
 
list _allInterestsCompleteCallbacks = []
 
 _completeDelayedCallback = None
 
 _completeEventCount = ScratchPad(num=0)
 
bool _noNewInterests = False
 
 _removeInterestEvent = uniqueName('DoInterestManager-Remove')
 
- Protected Attributes inherited from DirectObject
dict _taskList = {}
 
- Protected Attributes inherited from DoCollectionManager
 _doHierarchy = DoHierarchy.DoHierarchy()
 

Additional Inherited Members

- Static Protected Attributes inherited from DoInterestManager
int _ContextIdMask = 0x3FFFFFFF
 
int _ContextIdSerialNum = 100
 
list _debug_interestHistory = []
 
int _debug_maxDescriptionLen = 40
 
int _HandleMask = 0x7FFF
 
int _HandleSerialNum = 0
 
dict _interests = {}
 
 _SerialGen = SerialNumGen()
 
 _SerialNum = serialNum()
 

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__()

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

Member Function Documentation

◆ _adjustGcThreshold()

_adjustGcThreshold ( self,
task )
protected

◆ _garbageCollect()

_garbageCollect ( self,
task = None )
protected

◆ _getLostConnectionEvent()

_getLostConnectionEvent ( self)
protected

◆ checkHttp()

checkHttp ( self)

◆ connect()

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()

disconnect ( self)
Closes the previously-established connection.

◆ generateGlobalObject()

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

◆ getServerAddress()

getServerAddress ( self)

◆ handleDatagram()

handleDatagram ( self,
di )

Reimplemented in ClientRepository.

◆ handleReaderOverflow()

handleReaderOverflow ( self)

◆ httpConnectCallback()

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

◆ importModule()

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()

lostConnection ( self)

◆ readDCFile()

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()

readerPollOnce ( self)

◆ readerPollUntilEmpty()

readerPollUntilEmpty ( self,
task )

◆ send()

send ( self,
datagram )

◆ shutdown()

shutdown ( self)

◆ startReaderPollTask()

startReaderPollTask ( self)

◆ stopReaderPollTask()

stopReaderPollTask ( self)

Member Data Documentation

◆ _adjustGcThreshold

_adjustGcThreshold
protected

◆ _garbageCollect

_garbageCollect
protected

◆ _gcDefaultThreshold

_gcDefaultThreshold = gc.get_threshold()
protected

◆ _serverAddress

_serverAddress = ''
protected

◆ bootedIndex

bootedIndex = None

◆ bootedText

bootedText = None

◆ CM_HTTP

int CM_HTTP = 0
static

◆ CM_NATIVE

int CM_NATIVE = 2
static

◆ CM_NET

int CM_NET = 1
static

◆ config

config = config

◆ connectHttp

connectHttp = None

◆ connectMethod

int connectMethod = connectMethod

◆ dclassesByName

dict dclassesByName = {}

◆ dclassesByNumber

dict dclassesByNumber = {}

◆ dcSuffix

dcSuffix = ''

◆ GarbageCollectTaskName

GarbageCollectTaskName = "allowGarbageCollect"
static

◆ GarbageThresholdTaskName

GarbageThresholdTaskName = "adjustGarbageCollectThreshold"
static

◆ gcNotify

gcNotify = directNotify.newCategory("GarbageCollect")
static

◆ handleReaderOverflow

handleReaderOverflow

◆ hashVal

int hashVal = 0

◆ http

http = None

◆ lostConnection

lostConnection

◆ private__di

private__di = PyDatagramIterator()

◆ readerPollTaskObj

readerPollTaskObj = None

◆ recorder

recorder = None

◆ taskChain

taskChain = None
static

◆ taskPriority

int taskPriority = -30
static

◆ uniqueId

uniqueId = hash(self)