Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ConnectionRepository Class Reference
Inheritance diagram for ConnectionRepository:
DoInterestManager DoCollectionManager CConnectionRepository 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
 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 DoCollectionManager
 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 Member Functions inherited from CConnectionRepository
 __init__ (bool has_owner_view, bool threaded_net)
 
 abandonMessageBundles ()
 throw out any msgs that have been queued up for message bundles
 
 bundleMsg (const Datagram dg)
 
bool checkDatagram ()
 Returns true if a new datagram is available, false otherwise.
 
bool connectNative (const URLSpec url)
 Connects to the server using Panda's low-level and fast "native net" library.
 
bool considerFlush ()
 Sends the most recently queued data if enough time has elapsed.
 
 disconnect ()
 Closes the connection to the server.
 
bool flush ()
 Sends the most recently queued data now.
 
BufferedDatagramConnection getBdc ()
 Returns the Buffered_DatagramConnection object associated with the repository.
 
bool getClientDatagram ()
 Returns the client_datagram flag.
 
ConnectionWriter getCw ()
 Returns the ConnectionWriter object associated with the repository.
 
 getDatagram (Datagram dg)
 Fills the datagram object with the datagram most recently retrieved by check_datagram().
 
 getDatagramIterator (DatagramIterator di)
 Fills the DatagramIterator object with the iterator for the datagram most recently retrieved by check_datagram().
 
DCFile getDcFile ()
 Returns the DCFile object associated with this repository.
 
bool getHandleCUpdates ()
 Returns true if this repository will process distributed updates internally in C++ code, or false if it will return them to Python.
 
bool getHandleDatagramsInternally ()
 Returns the handle_datagrams_internally flag.
 
bool getInQuietZone ()
 Returns true if repository is in quiet zone mode.
 
CHANNELTYPE getMsgChannel (int offset)
 Returns the channel(s) to which the current message was sent, according to the datagram headers.
 
int getMsgChannelCount ()
 
CHANNELTYPE getMsgSender ()
 Returns the sender ID of the current message, according to the datagram headers.
 
unsigned int getMsgType ()
 Returns the type ID of the current message, according to the datagram headers.
 
QueuedConnectionManager getQcm ()
 Returns the QueuedConnectionManager object associated with the repository.
 
QueuedConnectionReader getQcr ()
 Returns the QueuedConnectionReader object associated with the repository.
 
bool getSimulatedDisconnect ()
 Returns the simulated disconnect flag.
 
SocketStream getStream ()
 Returns the SocketStream that internally represents the already-established HTTP connection.
 
int getTcpHeaderSize ()
 Returns the current setting of TCP header size.
 
float getTimeWarning ()
 Returns the current setting of the time_warning field.
 
bool getVerbose ()
 Returns the current setting of the verbose flag.
 
bool getWantMessageBundling ()
 Returns true if message bundling enabled.
 
bool hasOwnerView ()
 Returns true if this repository can have 'owner' views of distributed objects.
 
bool isBundlingMessages ()
 Returns true if repository is queueing outgoing messages into a message bundle.
 
bool isConnected ()
 Returns true if the connection to the gameserver is established and still good, false if we are not connected.
 
bool sendDatagram (const Datagram dg)
 Queues the indicated datagram for sending to the server.
 
 sendMessageBundle (unsigned int channel, unsigned int sender_channel)
 Send network messages queued up since startMessageBundle was called.
 
 setClientDatagram (bool client_datagram)
 Sets the client_datagram flag.
 
 setConnectionHttp (HTTPChannel channel)
 Once a connection has been established via the HTTP interface, gets the connection and uses it.
 
 setHandleCUpdates (bool handle_c_updates)
 Set true to specify this repository should process distributed updates internally in C++ code, or false if it should return them to Python.
 
 setHandleDatagramsInternally (bool handle_datagrams_internally)
 Sets the handle_datagrams_internally flag.
 
 setInQuietZone (bool flag)
 Enables/disables quiet zone mode.
 
 setPythonRepository (object python_repository)
 Records the pointer to the Python class that derives from CConnectionRepository.
 
 setSimulatedDisconnect (bool simulated_disconnect)
 Sets the simulated disconnect flag.
 
 setTcpHeaderSize (int tcp_header_size)
 Sets the header size of TCP packets.
 
 setTimeWarning (float time_warning)
 Directly sets the time_warning field.
 
 setVerbose (bool verbose)
 Directly sets the verbose flag.
 
 setWantMessageBundling (bool flag)
 Enable/disable outbound message bundling.
 
 shutdown ()
 May be called at application shutdown to ensure all threads are cleaned up.
 
 startMessageBundle ()
 Send a set of messages to the state server that will be processed atomically.
 
 toggleVerbose ()
 Toggles the current setting of the verbose flag.
 
bool tryConnectNet (const URLSpec url)
 Uses Panda's "net" library to try to connect to the server and port named in the indicated URL.
 

Public Attributes

 bootedIndex
 
 bootedText
 
 config
 
 connectHttp
 
 connectMethod
 
 dclassesByName
 
 dclassesByNumber
 
 dcSuffix
 
 GarbageCollectTaskName
 
 GarbageThresholdTaskName
 
 handleReaderOverflow
 
 hashVal
 
 http
 
 lostConnection
 
 private__di
 
 readerPollTaskObj
 
 readerPollUntilEmpty
 
 recorder
 
 uniqueId
 
- Public Attributes inherited from DoCollectionManager
 doId2do
 
 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")
 
 notify = directNotify.newCategory("ConnectionRepository")
 
 taskChain = None
 
int taskPriority = -30
 
- Static Public Attributes inherited from DoInterestManager
 InterestDebug = ConfigVariableBool('interest-debug', False)
 
 notify = directNotify.newCategory("DoInterestManager")
 

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 DoCollectionManager
 _compareDistance (self, do1, do2)
 
 _getDistanceFromLA (self, do)
 
 _printObjects (self, table)
 
 _returnObjects (self, table)
 

Protected Attributes

 _adjustGcThreshold
 
 _garbageCollect
 
 _gcDefaultThreshold
 
 _serverAddress
 
- Protected Attributes inherited from DoInterestManager
 _addInterestEvent
 
 _allInterestsCompleteCallbacks
 
 _completeDelayedCallback
 
 _completeEventCount
 
 _noNewInterests
 
 _removeInterestEvent
 
- Protected Attributes inherited from DoCollectionManager
 _doHierarchy
 

Additional Inherited Members

- Static Public Member Functions inherited from CConnectionRepository
static str getOverflowEventName ()
 Returns event string that will be thrown if the datagram reader queue overflows.
 
- 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 )

Reimplemented from DoInterestManager.

Reimplemented in ClientRepository, and ClientRepositoryBase.

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
protected

◆ _serverAddress

_serverAddress
protected

◆ bootedIndex

bootedIndex

◆ 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 [1/2]

str GarbageCollectTaskName = "allowGarbageCollect"
static

◆ GarbageCollectTaskName [2/2]

GarbageCollectTaskName

◆ GarbageThresholdTaskName [1/2]

str GarbageThresholdTaskName = "adjustGarbageCollectThreshold"
static

◆ GarbageThresholdTaskName [2/2]

GarbageThresholdTaskName

◆ gcNotify

gcNotify = directNotify.newCategory("GarbageCollect")
static

◆ handleReaderOverflow

handleReaderOverflow

◆ hashVal

hashVal

◆ http

http

◆ lostConnection

lostConnection

◆ notify

notify = directNotify.newCategory("ConnectionRepository")
static

◆ private__di

private__di

◆ readerPollTaskObj

readerPollTaskObj

◆ readerPollUntilEmpty

readerPollUntilEmpty

◆ recorder

recorder

◆ taskChain

taskChain = None
static

◆ taskPriority

int taskPriority = -30
static

◆ uniqueId

uniqueId