CConnectionRepository

from panda3d.direct import CConnectionRepository
class CConnectionRepository

Bases: DTOOL_SUPER_BASE

This class implements the C++ side of the ConnectionRepository object. In particular, it manages the connection to the server once it has been opened (but does not open it directly). It manages reading and writing datagrams on the connection and monitoring for unexpected disconnects as well as handling intentional disconnects.

Certain server messages, like field updates, are handled entirely within the C++ layer, while server messages that are not understood by the C++ layer are returned up to the Python layer for processing.

Inheritance diagram

Inheritance diagram of CConnectionRepository

__init__(*args, **kwargs)
abandonMessageBundles()

C++ Interface: abandon_message_bundles(const CConnectionRepository self)

/**
  • throw out any msgs that have been queued up for message bundles

*/

abandon_message_bundles()

C++ Interface: abandon_message_bundles(const CConnectionRepository self)

/**
  • throw out any msgs that have been queued up for message bundles

*/

bundleMsg()

C++ Interface: bundle_msg(const CConnectionRepository self, const Datagram dg)

/**

*/

bundle_msg()

C++ Interface: bundle_msg(const CConnectionRepository self, const Datagram dg)

/**

*/

checkDatagram()

C++ Interface: check_datagram(const CConnectionRepository self)

/**
  • Returns true if a new datagram is available, false otherwise. If the

  • return value is true, the new datagram may be retrieved via get_datagram(),

  • or preferably, with get_datagram_iterator() and get_msg_type().

*/

check_datagram()

C++ Interface: check_datagram(const CConnectionRepository self)

/**
  • Returns true if a new datagram is available, false otherwise. If the

  • return value is true, the new datagram may be retrieved via get_datagram(),

  • or preferably, with get_datagram_iterator() and get_msg_type().

*/

connectNative()

C++ Interface: connect_native(const CConnectionRepository self, const URLSpec url)

/**
  • Connects to the server using Panda’s low-level and fast “native net”

  • library.

*/

connect_native()

C++ Interface: connect_native(const CConnectionRepository self, const URLSpec url)

/**
  • Connects to the server using Panda’s low-level and fast “native net”

  • library.

*/

considerFlush()

C++ Interface: consider_flush(const CConnectionRepository self)

/**
  • Sends the most recently queued data if enough time has elapsed. This only

  • has meaning if set_collect_tcp() has been set to true.

*/

consider_flush()

C++ Interface: consider_flush(const CConnectionRepository self)

/**
  • Sends the most recently queued data if enough time has elapsed. This only

  • has meaning if set_collect_tcp() has been set to true.

*/

disconnect()

C++ Interface: disconnect(const CConnectionRepository self)

/**
  • Closes the connection to the server.

*/

flush()

C++ Interface: flush(const CConnectionRepository self)

/**
  • Sends the most recently queued data now. This only has meaning if

  • set_collect_tcp() has been set to true.

*/

getBdc()

C++ Interface: get_bdc(const CConnectionRepository self)

/**
  • Returns the Buffered_DatagramConnection object associated with the

  • repository.

*/

getClientDatagram()

C++ Interface: get_client_datagram(CConnectionRepository self)

/**
  • Returns the client_datagram flag.

*/

getCw()

C++ Interface: get_cw(const CConnectionRepository self)

/**
  • Returns the ConnectionWriter object associated with the repository.

*/

getDatagram()

C++ Interface: get_datagram(const CConnectionRepository self, Datagram dg)

/**
  • Fills the datagram object with the datagram most recently retrieved by

  • check_datagram().

*/

getDatagramIterator()

C++ Interface: get_datagram_iterator(const CConnectionRepository self, DatagramIterator di)

/**
  • Fills the DatagramIterator object with the iterator for the datagram most

  • recently retrieved by check_datagram(). This iterator has already read

  • past the datagram header and the message type, and is positioned at the

  • beginning of data.

*/

getDcFile()

C++ Interface: get_dc_file(const CConnectionRepository self)

/**
  • Returns the DCFile object associated with this repository.

*/

getHandleCUpdates()

C++ Interface: get_handle_c_updates(CConnectionRepository self)

/**
  • Returns true if this repository will process distributed updates internally

  • in C++ code, or false if it will return them to Python.

*/

getHandleDatagramsInternally()

C++ Interface: get_handle_datagrams_internally(CConnectionRepository self)

/**
  • Returns the handle_datagrams_internally flag.

*/

getInQuietZone()

C++ Interface: get_in_quiet_zone(CConnectionRepository self)

/**
  • Returns true if repository is in quiet zone mode

*/

getMsgChannel()

C++ Interface: get_msg_channel(CConnectionRepository self, int offset)

/**
  • Returns the channel(s) to which the current message was sent, according to

  • the datagram headers. This information is not available to the client.

*/

getMsgChannelCount()

C++ Interface: get_msg_channel_count(CConnectionRepository self)

getMsgSender()

C++ Interface: get_msg_sender(CConnectionRepository self)

/**
  • Returns the sender ID of the current message, according to the datagram

  • headers. This information is not available to the client.

*/

getMsgType()

C++ Interface: get_msg_type(CConnectionRepository self)

// INLINE unsigned char get_sec_code() const;

/**
  • Returns the type ID of the current message, according to the datagram

  • headers.

*/

getOverflowEventName()

C++ Interface: get_overflow_event_name()

/**
  • Returns event string that will be thrown if the datagram reader queue

  • overflows.

*/

getQcm()

C++ Interface: get_qcm(const CConnectionRepository self)

/**
  • Returns the QueuedConnectionManager object associated with the repository.

*/

getQcr()

C++ Interface: get_qcr(const CConnectionRepository self)

/**
  • Returns the QueuedConnectionReader object associated with the repository.

*/

getSimulatedDisconnect()

C++ Interface: get_simulated_disconnect(CConnectionRepository self)

/**
  • Returns the simulated disconnect flag. While this is true, no datagrams

  • will be retrieved from or sent to the server. The idea is to simulate a

  • temporary network outage.

*/

getStream()

C++ Interface: get_stream(const CConnectionRepository self)

/**
  • Returns the SocketStream that internally represents the already-established

  • HTTP connection. Returns NULL if there is no current HTTP connection.

*/

getTcpHeaderSize()

C++ Interface: get_tcp_header_size(CConnectionRepository self)

/**
  • Returns the current setting of TCP header size. See set_tcp_header_size().

*/

getTimeWarning()

C++ Interface: get_time_warning(CConnectionRepository self)

/**
  • Returns the current setting of the time_warning field.

*/

getVerbose()

C++ Interface: get_verbose(CConnectionRepository self)

/**
  • Returns the current setting of the verbose flag. When true, this describes

  • every message going back and forth on the wire.

*/

getWantMessageBundling()

C++ Interface: get_want_message_bundling(CConnectionRepository self)

/**
  • Returns true if message bundling enabled

*/

get_bdc()

C++ Interface: get_bdc(const CConnectionRepository self)

/**
  • Returns the Buffered_DatagramConnection object associated with the

  • repository.

*/

get_client_datagram()

C++ Interface: get_client_datagram(CConnectionRepository self)

/**
  • Returns the client_datagram flag.

*/

get_cw()

C++ Interface: get_cw(const CConnectionRepository self)

/**
  • Returns the ConnectionWriter object associated with the repository.

*/

get_datagram()

C++ Interface: get_datagram(const CConnectionRepository self, Datagram dg)

/**
  • Fills the datagram object with the datagram most recently retrieved by

  • check_datagram().

*/

get_datagram_iterator()

C++ Interface: get_datagram_iterator(const CConnectionRepository self, DatagramIterator di)

/**
  • Fills the DatagramIterator object with the iterator for the datagram most

  • recently retrieved by check_datagram(). This iterator has already read

  • past the datagram header and the message type, and is positioned at the

  • beginning of data.

*/

get_dc_file()

C++ Interface: get_dc_file(const CConnectionRepository self)

/**
  • Returns the DCFile object associated with this repository.

*/

get_handle_c_updates()

C++ Interface: get_handle_c_updates(CConnectionRepository self)

/**
  • Returns true if this repository will process distributed updates internally

  • in C++ code, or false if it will return them to Python.

*/

get_handle_datagrams_internally()

C++ Interface: get_handle_datagrams_internally(CConnectionRepository self)

/**
  • Returns the handle_datagrams_internally flag.

*/

get_in_quiet_zone()

C++ Interface: get_in_quiet_zone(CConnectionRepository self)

/**
  • Returns true if repository is in quiet zone mode

*/

get_msg_channel()

C++ Interface: get_msg_channel(CConnectionRepository self, int offset)

/**
  • Returns the channel(s) to which the current message was sent, according to

  • the datagram headers. This information is not available to the client.

*/

get_msg_channel_count()

C++ Interface: get_msg_channel_count(CConnectionRepository self)

get_msg_sender()

C++ Interface: get_msg_sender(CConnectionRepository self)

/**
  • Returns the sender ID of the current message, according to the datagram

  • headers. This information is not available to the client.

*/

get_msg_type()

C++ Interface: get_msg_type(CConnectionRepository self)

// INLINE unsigned char get_sec_code() const;

/**
  • Returns the type ID of the current message, according to the datagram

  • headers.

*/

get_overflow_event_name()

C++ Interface: get_overflow_event_name()

/**
  • Returns event string that will be thrown if the datagram reader queue

  • overflows.

*/

get_qcm()

C++ Interface: get_qcm(const CConnectionRepository self)

/**
  • Returns the QueuedConnectionManager object associated with the repository.

*/

get_qcr()

C++ Interface: get_qcr(const CConnectionRepository self)

/**
  • Returns the QueuedConnectionReader object associated with the repository.

*/

get_simulated_disconnect()

C++ Interface: get_simulated_disconnect(CConnectionRepository self)

/**
  • Returns the simulated disconnect flag. While this is true, no datagrams

  • will be retrieved from or sent to the server. The idea is to simulate a

  • temporary network outage.

*/

get_stream()

C++ Interface: get_stream(const CConnectionRepository self)

/**
  • Returns the SocketStream that internally represents the already-established

  • HTTP connection. Returns NULL if there is no current HTTP connection.

*/

get_tcp_header_size()

C++ Interface: get_tcp_header_size(CConnectionRepository self)

/**
  • Returns the current setting of TCP header size. See set_tcp_header_size().

*/

get_time_warning()

C++ Interface: get_time_warning(CConnectionRepository self)

/**
  • Returns the current setting of the time_warning field.

*/

get_verbose()

C++ Interface: get_verbose(CConnectionRepository self)

/**
  • Returns the current setting of the verbose flag. When true, this describes

  • every message going back and forth on the wire.

*/

get_want_message_bundling()

C++ Interface: get_want_message_bundling(CConnectionRepository self)

/**
  • Returns true if message bundling enabled

*/

hasOwnerView()

C++ Interface: has_owner_view(CConnectionRepository self)

/**
  • Returns true if this repository can have ‘owner’ views of distributed

  • objects.

*/

has_owner_view()

C++ Interface: has_owner_view(CConnectionRepository self)

/**
  • Returns true if this repository can have ‘owner’ views of distributed

  • objects.

*/

isBundlingMessages()

C++ Interface: is_bundling_messages(CConnectionRepository self)

/**
  • Returns true if repository is queueing outgoing messages into a message

  • bundle

*/

isConnected()

C++ Interface: is_connected(const CConnectionRepository self)

/**
  • Returns true if the connection to the gameserver is established and still

  • good, false if we are not connected. A false value means either (a) we

  • never successfully connected, (b) we explicitly called disconnect(), or (c)

  • we were connected, but the connection was spontaneously lost.

*/

is_bundling_messages()

C++ Interface: is_bundling_messages(CConnectionRepository self)

/**
  • Returns true if repository is queueing outgoing messages into a message

  • bundle

*/

is_connected()

C++ Interface: is_connected(const CConnectionRepository self)

/**
  • Returns true if the connection to the gameserver is established and still

  • good, false if we are not connected. A false value means either (a) we

  • never successfully connected, (b) we explicitly called disconnect(), or (c)

  • we were connected, but the connection was spontaneously lost.

*/

sendDatagram()

C++ Interface: send_datagram(const CConnectionRepository self, const Datagram dg)

/**
  • Queues the indicated datagram for sending to the server. It may not get

  • sent immediately if collect_tcp is in effect; call flush() to guarantee it

  • is sent now.

*/

sendMessageBundle()

C++ Interface: send_message_bundle(const CConnectionRepository self, int channel, int sender_channel)

/**
  • Send network messages queued up since startMessageBundle was called.

*/

send_datagram()

C++ Interface: send_datagram(const CConnectionRepository self, const Datagram dg)

/**
  • Queues the indicated datagram for sending to the server. It may not get

  • sent immediately if collect_tcp is in effect; call flush() to guarantee it

  • is sent now.

*/

send_message_bundle()

C++ Interface: send_message_bundle(const CConnectionRepository self, int channel, int sender_channel)

/**
  • Send network messages queued up since startMessageBundle was called.

*/

setClientDatagram()

C++ Interface: set_client_datagram(const CConnectionRepository self, bool client_datagram)

/**
  • Sets the client_datagram flag. If this is true, incoming datagrams are not

  • expected to be prefixed with the server routing information like message

  • sender, channel number, etc.; otherwise, these server fields are parsed and

  • removed from each incoming datagram.

*/

setConnectionHttp()

C++ Interface: set_connection_http(const CConnectionRepository self, HTTPChannel channel)

/**
  • Once a connection has been established via the HTTP interface, gets the

  • connection and uses it. The supplied HTTPChannel object must have a

  • connection available via get_connection().

*/

setHandleCUpdates()

C++ Interface: set_handle_c_updates(const CConnectionRepository self, 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()

C++ Interface: set_handle_datagrams_internally(const CConnectionRepository self, bool handle_datagrams_internally)

/**
  • Sets the handle_datagrams_internally flag. When true, certain message

  • types can be handled by the C++ code in in this module. When false, all

  • datagrams, regardless of message type, are passed up to Python for

  • processing.

  • The CMU distributed-object implementation requires this to be set false.

*/

setInQuietZone()

C++ Interface: set_in_quiet_zone(const CConnectionRepository self, bool flag)

/**
  • Enables/disables quiet zone mode

*/

setPythonRepository()

C++ Interface: set_python_repository(const CConnectionRepository self, object python_repository)

/**
  • Records the pointer to the Python class that derives from

  • CConnectionRepository. This allows the C++ implementation to directly

  • manipulation some python structures on the repository.

*/

setSimulatedDisconnect()

C++ Interface: set_simulated_disconnect(const CConnectionRepository self, bool simulated_disconnect)

/**
  • Sets the simulated disconnect flag. While this is true, no datagrams will

  • be retrieved from or sent to the server. The idea is to simulate a

  • temporary network outage.

*/

setTcpHeaderSize()

C++ Interface: set_tcp_header_size(const CConnectionRepository self, int tcp_header_size)

/**
  • Sets the header size of TCP packets. At the present, legal values for this

  • are 0, 2, or 4; this specifies the number of bytes to use encode the

  • datagram length at the start of each TCP datagram. Sender and receiver

  • must independently agree on this.

*/

setTimeWarning()

C++ Interface: set_time_warning(const CConnectionRepository self, float time_warning)

/**
  • Directly sets the time_warning field. When non zero, this describes every

  • message going back and forth on the wire when the msg handling time is over

  • it

*/

setVerbose()

C++ Interface: set_verbose(const CConnectionRepository self, bool verbose)

/**
  • Directly sets the verbose flag. When true, this describes every message

  • going back and forth on the wire.

*/

setWantMessageBundling()

C++ Interface: set_want_message_bundling(const CConnectionRepository self, bool flag)

/**
  • Enable/disable outbound message bundling

*/

set_client_datagram()

C++ Interface: set_client_datagram(const CConnectionRepository self, bool client_datagram)

/**
  • Sets the client_datagram flag. If this is true, incoming datagrams are not

  • expected to be prefixed with the server routing information like message

  • sender, channel number, etc.; otherwise, these server fields are parsed and

  • removed from each incoming datagram.

*/

set_connection_http()

C++ Interface: set_connection_http(const CConnectionRepository self, HTTPChannel channel)

/**
  • Once a connection has been established via the HTTP interface, gets the

  • connection and uses it. The supplied HTTPChannel object must have a

  • connection available via get_connection().

*/

set_handle_c_updates()

C++ Interface: set_handle_c_updates(const CConnectionRepository self, 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.

*/

set_handle_datagrams_internally()

C++ Interface: set_handle_datagrams_internally(const CConnectionRepository self, bool handle_datagrams_internally)

/**
  • Sets the handle_datagrams_internally flag. When true, certain message

  • types can be handled by the C++ code in in this module. When false, all

  • datagrams, regardless of message type, are passed up to Python for

  • processing.

  • The CMU distributed-object implementation requires this to be set false.

*/

set_in_quiet_zone()

C++ Interface: set_in_quiet_zone(const CConnectionRepository self, bool flag)

/**
  • Enables/disables quiet zone mode

*/

set_python_repository()

C++ Interface: set_python_repository(const CConnectionRepository self, object python_repository)

/**
  • Records the pointer to the Python class that derives from

  • CConnectionRepository. This allows the C++ implementation to directly

  • manipulation some python structures on the repository.

*/

set_simulated_disconnect()

C++ Interface: set_simulated_disconnect(const CConnectionRepository self, bool simulated_disconnect)

/**
  • Sets the simulated disconnect flag. While this is true, no datagrams will

  • be retrieved from or sent to the server. The idea is to simulate a

  • temporary network outage.

*/

set_tcp_header_size()

C++ Interface: set_tcp_header_size(const CConnectionRepository self, int tcp_header_size)

/**
  • Sets the header size of TCP packets. At the present, legal values for this

  • are 0, 2, or 4; this specifies the number of bytes to use encode the

  • datagram length at the start of each TCP datagram. Sender and receiver

  • must independently agree on this.

*/

set_time_warning()

C++ Interface: set_time_warning(const CConnectionRepository self, float time_warning)

/**
  • Directly sets the time_warning field. When non zero, this describes every

  • message going back and forth on the wire when the msg handling time is over

  • it

*/

set_verbose()

C++ Interface: set_verbose(const CConnectionRepository self, bool verbose)

/**
  • Directly sets the verbose flag. When true, this describes every message

  • going back and forth on the wire.

*/

set_want_message_bundling()

C++ Interface: set_want_message_bundling(const CConnectionRepository self, bool flag)

/**
  • Enable/disable outbound message bundling

*/

shutdown()

C++ Interface: shutdown(const CConnectionRepository self)

/**
  • May be called at application shutdown to ensure all threads are cleaned up.

*/

startMessageBundle()

C++ Interface: start_message_bundle(const CConnectionRepository self)

/**
  • Send a set of messages to the state server that will be processed

  • atomically. For instance, you can do a combined setLocation/setPos and

  • prevent race conditions where clients briefly get the setLocation but not

  • the setPos, because the state server hasn’t processed the setPos yet

*/

start_message_bundle()

C++ Interface: start_message_bundle(const CConnectionRepository self)

/**
  • Send a set of messages to the state server that will be processed

  • atomically. For instance, you can do a combined setLocation/setPos and

  • prevent race conditions where clients briefly get the setLocation but not

  • the setPos, because the state server hasn’t processed the setPos yet

*/

toggleVerbose()

C++ Interface: toggle_verbose(const CConnectionRepository self)

/**
  • Toggles the current setting of the verbose flag. When true, this describes

  • every message going back and forth on the wire.

*/

toggle_verbose()

C++ Interface: toggle_verbose(const CConnectionRepository self)

/**
  • Toggles the current setting of the verbose flag. When true, this describes

  • every message going back and forth on the wire.

*/

tryConnectNet()

C++ Interface: try_connect_net(const CConnectionRepository self, const URLSpec url)

/**
  • Uses Panda’s “net” library to try to connect to the server and port named

  • in the indicated URL. Returns true if successful, false otherwise.

*/

try_connect_net()

C++ Interface: try_connect_net(const CConnectionRepository self, const URLSpec url)

/**
  • Uses Panda’s “net” library to try to connect to the server and port named

  • in the indicated URL. Returns true if successful, false otherwise.

*/