diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-16 22:14:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-16 22:14:21 +0100 |
commit | 97ce8708e86b4cf17b01f7f8ddfd74e348fbb56c (patch) | |
tree | f811073a9346b5718788ee5b954c5aba5c878465 /core | |
parent | a6066c5e42765a8b41f3e331ffa080ddc9624641 (diff) | |
parent | 87353c90fa2a3b8128a9fa925f5083a8ac1d57a2 (diff) |
Merge pull request #47076 from Faless/debugger/4.x_remote_peer_backoff
[Net] Make debugger peer less CPU intensive.
Diffstat (limited to 'core')
-rw-r--r-- | core/debugger/remote_debugger_peer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/debugger/remote_debugger_peer.cpp b/core/debugger/remote_debugger_peer.cpp index 857e3af268..90b0975159 100644 --- a/core/debugger/remote_debugger_peer.cpp +++ b/core/debugger/remote_debugger_peer.cpp @@ -190,13 +190,18 @@ Error RemoteDebuggerPeerTCP::connect_to_host(const String &p_host, uint16_t p_po } void RemoteDebuggerPeerTCP::_thread_func(void *p_ud) { + const uint64_t min_tick = 100; RemoteDebuggerPeerTCP *peer = (RemoteDebuggerPeerTCP *)p_ud; while (peer->running && peer->is_peer_connected()) { + uint64_t ticks_usec = OS::get_singleton()->get_ticks_usec(); peer->_poll(); if (!peer->is_peer_connected()) { break; } - peer->tcp_client->poll(NetSocket::POLL_TYPE_IN_OUT, 1); + ticks_usec = OS::get_singleton()->get_ticks_usec() - ticks_usec; + if (ticks_usec < min_tick) { + OS::get_singleton()->delay_usec(min_tick - ticks_usec); + } } } |