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,17 +365,28 @@ report_new_collectors() {
|
||||
nassertv(_is_connected);
|
||||
|
||||
if (_collectors_reported < (int)_client->_collectors.size()) {
|
||||
// Empirically, we determined that you can't send more than about
|
||||
// 1400 collectors at once without exceeding the 64K limit on a
|
||||
// single datagram. So we limit ourselves here to sending only
|
||||
// half that many.
|
||||
static const int max_collectors_at_once = 700;
|
||||
|
||||
while (_collectors_reported < (int)_client->_collectors.size()) {
|
||||
PStatClientControlMessage message;
|
||||
message._type = PStatClientControlMessage::T_define_collectors;
|
||||
while (_collectors_reported < (int)_client->_collectors.size()) {
|
||||
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