mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
don't crash when the system includes more than 1400 collectors
This commit is contained in:
parent
33c2803608
commit
5181b69662
@ -365,16 +365,27 @@ report_new_collectors() {
|
|||||||
nassertv(_is_connected);
|
nassertv(_is_connected);
|
||||||
|
|
||||||
if (_collectors_reported < (int)_client->_collectors.size()) {
|
if (_collectors_reported < (int)_client->_collectors.size()) {
|
||||||
PStatClientControlMessage message;
|
// Empirically, we determined that you can't send more than about
|
||||||
message._type = PStatClientControlMessage::T_define_collectors;
|
// 1400 collectors at once without exceeding the 64K limit on a
|
||||||
while (_collectors_reported < (int)_client->_collectors.size()) {
|
// single datagram. So we limit ourselves here to sending only
|
||||||
message._collectors.push_back(_client->get_collector_def(_collectors_reported));
|
// half that many.
|
||||||
_collectors_reported++;
|
static const int max_collectors_at_once = 700;
|
||||||
}
|
|
||||||
|
|
||||||
Datagram datagram;
|
while (_collectors_reported < (int)_client->_collectors.size()) {
|
||||||
message.encode(datagram);
|
PStatClientControlMessage message;
|
||||||
_writer.send(datagram, _tcp_connection);
|
message._type = PStatClientControlMessage::T_define_collectors;
|
||||||
|
int i = 0;
|
||||||
|
while (_collectors_reported < (int)_client->_collectors.size() &&
|
||||||
|
i < max_collectors_at_once) {
|
||||||
|
message._collectors.push_back(_client->get_collector_def(_collectors_reported));
|
||||||
|
_collectors_reported++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Datagram datagram;
|
||||||
|
message.encode(datagram);
|
||||||
|
_writer.send(datagram, _tcp_connection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user