mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
added setWantMessageBundling
This commit is contained in:
parent
859f6904b8
commit
8cae40674b
@ -258,6 +258,28 @@ is_bundling_messages() const {
|
|||||||
return _bundling_msgs > 0;
|
return _bundling_msgs > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: CConnectionRepository::set_want_message_bundling
|
||||||
|
// Access: Published
|
||||||
|
// Description: Enable/disable outbound message bundling
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void CConnectionRepository::
|
||||||
|
set_want_message_bundling(bool flag) {
|
||||||
|
// don't allow enable/disable while bundling
|
||||||
|
nassertv(_bundling_msgs == 0);
|
||||||
|
_want_message_bundling = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: CConnectionRepository::get_want_message_bundling
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if message bundling enabled
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool CConnectionRepository::
|
||||||
|
get_want_message_bundling() const {
|
||||||
|
return _want_message_bundling;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: CConnectionRepository::set_simulated_disconnect
|
// Function: CConnectionRepository::set_simulated_disconnect
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -72,6 +72,7 @@ CConnectionRepository(bool has_owner_view) :
|
|||||||
_msg_type(0),
|
_msg_type(0),
|
||||||
_has_owner_view(has_owner_view),
|
_has_owner_view(has_owner_view),
|
||||||
_handle_c_updates(true),
|
_handle_c_updates(true),
|
||||||
|
_want_message_bundling(true),
|
||||||
_bundling_msgs(0)
|
_bundling_msgs(0)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_NET) && defined(SIMULATE_NETWORK_DELAY)
|
#if defined(HAVE_NET) && defined(SIMULATE_NETWORK_DELAY)
|
||||||
@ -392,7 +393,7 @@ send_datagram(const Datagram &dg) {
|
|||||||
describe_message(nout, "SEND", dg);
|
describe_message(nout, "SEND", dg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_bundling_messages()) {
|
if (is_bundling_messages() && get_want_message_bundling()) {
|
||||||
bundle_msg(dg);
|
bundle_msg(dg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -466,7 +467,7 @@ send_message_bundle(unsigned int channel, unsigned int sender_channel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if _bundling_msgs ref count is zero, send the bundle out
|
// if _bundling_msgs ref count is zero, send the bundle out
|
||||||
if (_bundling_msgs == 0) {
|
if (_bundling_msgs == 0 && get_want_message_bundling()) {
|
||||||
Datagram dg;
|
Datagram dg;
|
||||||
// add server header (see PyDatagram.addServerHeader)
|
// add server header (see PyDatagram.addServerHeader)
|
||||||
dg.add_int8(1);
|
dg.add_int8(1);
|
||||||
|
@ -123,6 +123,9 @@ PUBLISHED:
|
|||||||
|
|
||||||
bool send_datagram(const Datagram &dg);
|
bool send_datagram(const Datagram &dg);
|
||||||
|
|
||||||
|
INLINE void set_want_message_bundling(bool flag);
|
||||||
|
INLINE bool get_want_message_bundling() const;
|
||||||
|
|
||||||
void start_message_bundle();
|
void start_message_bundle();
|
||||||
INLINE bool is_bundling_messages() const;
|
INLINE bool is_bundling_messages() const;
|
||||||
void send_message_bundle(unsigned int channel, unsigned int sender_channel);
|
void send_message_bundle(unsigned int channel, unsigned int sender_channel);
|
||||||
@ -193,6 +196,7 @@ private:
|
|||||||
|
|
||||||
static const string _overflow_event_name;
|
static const string _overflow_event_name;
|
||||||
|
|
||||||
|
bool _want_message_bundling;
|
||||||
unsigned int _bundling_msgs;
|
unsigned int _bundling_msgs;
|
||||||
typedef std::vector< const string > BundledMsgVector;
|
typedef std::vector< const string > BundledMsgVector;
|
||||||
BundledMsgVector _bundle_msgs;
|
BundledMsgVector _bundle_msgs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user