mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 16:20:11 -04:00
pstats: Server can handle new protocol version 2.3
It changes the following things: * Changes the counts in the PStatFrameData from uint16 to uint32, since I was hitting the value limit in some heavy frames with Python profiling enabled - no good reason for this limitation, so this allows removing it later * Adds a T_expire_thread message, which I can use later to fix #450 These features are not used on the client side, but will be used on master. Adding these changes here now makes it possible to use a master client with a 1.10.13 version of the server (can be useful if you can't compile Panda on the host).
This commit is contained in:
parent
3254c6d329
commit
fb14c29525
@ -60,6 +60,10 @@ encode(Datagram &datagram) const {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_expire_thread:
|
||||||
|
datagram.add_uint16(_first_thread_index);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
pstats_cat.error()
|
pstats_cat.error()
|
||||||
<< "Invalid PStatClientControlMessage::Type " << (int)_type << "\n";
|
<< "Invalid PStatClientControlMessage::Type " << (int)_type << "\n";
|
||||||
@ -111,6 +115,10 @@ decode(const Datagram &datagram, PStatClientVersion *version) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_expire_thread:
|
||||||
|
_first_thread_index = source.get_uint16();
|
||||||
|
break;
|
||||||
|
|
||||||
case T_datagram:
|
case T_datagram:
|
||||||
// Not, strictly speaking, a control message.
|
// Not, strictly speaking, a control message.
|
||||||
return false;
|
return false;
|
||||||
|
@ -39,6 +39,7 @@ public:
|
|||||||
T_hello,
|
T_hello,
|
||||||
T_define_collectors,
|
T_define_collectors,
|
||||||
T_define_threads,
|
T_define_threads,
|
||||||
|
T_expire_thread,
|
||||||
T_invalid
|
T_invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,11 +106,16 @@ write_datagram(Datagram &destination, PStatClient *client) const {
|
|||||||
* Extracts the FrameData definition from the datagram.
|
* Extracts the FrameData definition from the datagram.
|
||||||
*/
|
*/
|
||||||
void PStatFrameData::
|
void PStatFrameData::
|
||||||
read_datagram(DatagramIterator &source, PStatClientVersion *) {
|
read_datagram(DatagramIterator &source, PStatClientVersion *version) {
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t time_size = source.get_uint16();
|
size_t time_size;
|
||||||
|
if (version->is_at_least(3, 2)) {
|
||||||
|
time_size = source.get_uint32();
|
||||||
|
} else {
|
||||||
|
time_size = source.get_uint16();
|
||||||
|
}
|
||||||
_time_data.resize(time_size);
|
_time_data.resize(time_size);
|
||||||
for (DataPoint &dp : _time_data) {
|
for (DataPoint &dp : _time_data) {
|
||||||
nassertv(source.get_remaining_size() > 0);
|
nassertv(source.get_remaining_size() > 0);
|
||||||
@ -120,7 +125,12 @@ read_datagram(DatagramIterator &source, PStatClientVersion *) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t level_size = source.get_uint16();
|
size_t level_size;
|
||||||
|
if (version->is_at_least(3, 2)) {
|
||||||
|
level_size = source.get_uint32();
|
||||||
|
} else {
|
||||||
|
level_size = source.get_uint16();
|
||||||
|
}
|
||||||
_level_data.resize(level_size);
|
_level_data.resize(level_size);
|
||||||
for (DataPoint &dp : _level_data) {
|
for (DataPoint &dp : _level_data) {
|
||||||
nassertv(source.get_remaining_size() > 0);
|
nassertv(source.get_remaining_size() > 0);
|
||||||
|
@ -31,6 +31,7 @@ static const int current_pstat_minor_version = 0;
|
|||||||
// Incremented to 2.1 on 5/21/01 to add support for TCP frame data.
|
// Incremented to 2.1 on 5/21/01 to add support for TCP frame data.
|
||||||
// Incremented to 3.0 on 4/28/05 to bump TCP headers to 32 bits.
|
// Incremented to 3.0 on 4/28/05 to bump TCP headers to 32 bits.
|
||||||
// Incremented to 3.1 on 11/29/22 to support nested start/stop pairs.
|
// Incremented to 3.1 on 11/29/22 to support nested start/stop pairs.
|
||||||
|
// Incremented to 3.2 on 12/10/22 to use 32-bit data counts, T_expire_thread.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current major version number of the PStats protocol. This is
|
* Returns the current major version number of the PStats protocol. This is
|
||||||
|
@ -194,7 +194,7 @@ handle_client_control_message(const PStatClientControlMessage &message) {
|
|||||||
if (message._major_version != server_major_version ||
|
if (message._major_version != server_major_version ||
|
||||||
(message._major_version == server_major_version &&
|
(message._major_version == server_major_version &&
|
||||||
message._minor_version > server_minor_version &&
|
message._minor_version > server_minor_version &&
|
||||||
(message._major_version != 3 || message._minor_version != 1))) {
|
(message._major_version != 3 || message._minor_version > 2))) {
|
||||||
_monitor->bad_version(message._client_hostname, message._client_progname,
|
_monitor->bad_version(message._client_hostname, message._client_progname,
|
||||||
message._major_version, message._minor_version,
|
message._major_version, message._minor_version,
|
||||||
server_major_version, server_minor_version);
|
server_major_version, server_minor_version);
|
||||||
@ -225,6 +225,10 @@ handle_client_control_message(const PStatClientControlMessage &message) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PStatClientControlMessage::T_expire_thread:
|
||||||
|
// Ignore for now.
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
nout << "Invalid control message received from client.\n";
|
nout << "Invalid control message received from client.\n";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user