diff --git a/.efrocachemap b/.efrocachemap index 7513517c..a440fa18 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3934,48 +3934,48 @@ "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", "ballisticacore-windows/Generic/BallisticaCore.ico": "https://files.ballistica.net/cache/ba1/89/c0/e32c7d2a35dc9aef57cc73b0911a", - "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/6c/4a/ea20aa40a0336346481db7a3e7cc", + "build/prefab/full/linux_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/61/8d/3bd881b575b20d2539aebc3c5fbc", "build/prefab/full/linux_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/74/1d/fc9e33e565475daaac80da5252f0", - "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/79/a4/151c407676751226822b7f3fea28", - "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/20/af/c30bf81152b21bd3e659dbc5ad98", - "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a4/c5/f80651437601406ed7fc851e04de", + "build/prefab/full/linux_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d2/ea/6381f6acbfa7e34c1af6b97748fc", + "build/prefab/full/linux_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d0/91/08129c632d8ab190f616bfcc8d81", + "build/prefab/full/linux_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/16/81/6cade558876a9853ffb41bd97d2f", "build/prefab/full/linux_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9c/7b/ac1a200be0f37078af0991faca3b", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a8/3f/7cbb7f9e5d683bff4998adaaf90e", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/14/62/e9048f67d7fd8e2b16ce19bd5f62", - "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/9a/35/1bda678f84232eda0f1a2725e055", - "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/42/73/3cde5ac6f418bc51056c66688f9c", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a6/0a/6c825e16fd7c38b333a1990a5284", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/22/74/c198da8f0a9f2c5b635bc6dba1eb", - "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/72/2b/ec334129de9d4f178be5edde6bee", - "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/9e/50/d602765c67c81a5facbb2b664782", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/65/ad/7d6f7fd1d37f5ea04bb0c7cddb4b", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a9/b3/8b9a84ef02d04c2cd7af03ca2ccf", - "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/d5/0c/5ac1824e4ac58feeb406a245d519", - "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/d2/72/f6e138e469270e3755c129280ff4", - "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/2c/43/08f790d0825208e1aef8bc4f0108", - "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/00/44/a30d83adcc04eb9814f2fa482e8d", - "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7d/b6/475f313a5e1163d8b18f81fda053", - "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6c/78/4d4cd81c4b925a202fe4d961ab69", - "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ce/42/dabc253464415881a92d09a5cbcb", - "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/4b/a7/b804cf37c6a0a8bdea337cea46bd", - "build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d4/94/7b0f516265c70560e1bf1d18f2ea", - "build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/78/94/511518ff21c6c3a1bc7b9fa93b7c", - "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/94/81/89b407831bd33add7352a5fee999", - "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/48/0d0267c5a762f84fdf586424c019", - "build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/75/1a/d0c55f75fe6d03b73f5360565960", - "build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9f/0b/c65635939f4add78f7beb2102ac7", - "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d9/dd/deb6244a9c6976e99c412e0f5bb6", - "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/80/52/a34c0d75141644db597eccc53707", - "build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/88/b9/fd10f8de886d31092215078537bf", - "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/52/b2/d066bd3e31452e6662d055f7f7a4", - "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b0/2e/bd0ad8735d54d5fb7cf480f9dc88", - "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/80/9f/eac377e047bcd3354d20cca82a98", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/42/77/1921f1016cb750497752ec391b1c", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/0e/41/d04161c863b9fa6d5100a2a0f5d3", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/04/8e/81d41aca26fa174f151c1dbb64c1", - "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/4e/36/eb1968777618567a57c06037fc16", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/36/05/bdbffaab5039230c2fbcb7d8c878", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/e7/c4/324bb33d12a37d46c6a38da7a63d", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/2a/d8/77387d2781de3bb624538c80a2cc", - "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/b1/51/67daef6f5638ddf3ebeb61186539" + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/15/82/c837b1277ce68259927ee76c70a2", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/87/38/d41db38f2a4b6c82e2f0190ac0c1", + "build/prefab/full/mac_arm64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/8c/4c/440acf05835f677f02bf45eea5f3", + "build/prefab/full/mac_arm64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/60/7c/036d94438a4c6688a19560586cc6", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/dd/66/5ccf21a659e5a93f554041196002", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8d/a2/4bbbed39caf3ad45e97fd855bffc", + "build/prefab/full/mac_x86_64_gui/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/ee/b6/0667a97d33810d50126bb5c2e79a", + "build/prefab/full/mac_x86_64_gui/release/ballisticacore": "https://files.ballistica.net/cache/ba1/1e/ec/1dce16e09b5d2efbe86d9ef1fd22", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/03/d3/ade627a7f28d6443f03753e67c8c", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/56/72/65f211669bf7e59dc752505e70fa", + "build/prefab/full/windows_x86_gui/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/2d/45/0f969be014d94450e0fecddb6892", + "build/prefab/full/windows_x86_gui/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/1a/5b/f4f09d532190b2f374c769c36595", + "build/prefab/full/windows_x86_server/debug/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/a2/f6/8ffa679c2219a41925c89d49e77b", + "build/prefab/full/windows_x86_server/release/dist/BallisticaCoreHeadless.exe": "https://files.ballistica.net/cache/ba1/08/1b/81b4d00361b1c98e729929de3af4", + "build/prefab/lib/linux_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9a/32/bda06e355384dac2fc81c8357812", + "build/prefab/lib/linux_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/34/f6/b4db57144d47cfdb153dd4de6742", + "build/prefab/lib/linux_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/53/44/cf4405c2ebe2695d55858129d3fe", + "build/prefab/lib/linux_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e6/3c/8f64df25f1ee5b24f736ef1ac1c9", + "build/prefab/lib/linux_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f3/c1/9e4b57841605233b5dafc037b4af", + "build/prefab/lib/linux_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/9c/4d/8278e894bdb212032e21cdcf9691", + "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d5/2e/102e5cacaaaad2a25b5c708f7234", + "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/67/af/38cae008d29ab96d399f06172739", + "build/prefab/lib/mac_arm64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/13/87/6a92eb1475b81d62a129612c0188", + "build/prefab/lib/mac_arm64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/67/aa/7e132a33ae0c06f50ae67a11ee34", + "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b5/66/89272c8577954d2382ec60b9f0af", + "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8b/0e/0e82816929e595543b0aaac49978", + "build/prefab/lib/mac_x86_64_gui/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1e/38/59b3b58320e5680e86732823ae78", + "build/prefab/lib/mac_x86_64_gui/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b5/5b/0390ee8916f97d302cde3ea356bc", + "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/7a/ee/8249ede29becc0cd41178924b6dc", + "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c0/5f/e89024a87dd092f6e0cc43afb707", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/98/96/f64c1236e4f328e1fec0d42ccd1f", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/8f/a6/e7e3bdf82333c7971eda5f01974c", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/e8/a4/eea8a31ffa673b3b7f2ead00c737", + "build/prefab/lib/windows/Debug_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/73/f7/04dcf8b208008d93110d494f4277", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.lib": "https://files.ballistica.net/cache/ba1/8b/b4/e345000aa4c97bd1f7527360d315", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreGenericInternal.pdb": "https://files.ballistica.net/cache/ba1/cf/99/0dd1c00a7155bcfba6fe905fe5b6", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.lib": "https://files.ballistica.net/cache/ba1/e8/c5/17a85bd9d4e012e8ef726c453fbc", + "build/prefab/lib/windows/Release_Win32/BallisticaCoreHeadlessInternal.pdb": "https://files.ballistica.net/cache/ba1/39/a3/aa835091c1b383211d5751a0ed5e" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a8b54f71..2a200915 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ -### 1.6.4 (20371) +### 1.6.4 (20382) - Some cleanups in the Favorites tab of the gather window. - Reorganized prefab target names; some targets such as `prefab-debug` are now `prefab-gui-debug` (more consistent with the existing `prefab-server-debug` targets). - Windows builds now go to build/windows instead of ballisticacore_windows/build. +- Lots of project reorganization to allow things such as documentation or the dummy _ba.py module to be rebuilt from the public repo. +- Added network flood attack mitigation. ### 1.6.3 (20366) - Telnet access works again for gui builds without requiring a password (access must still be granted via the gui). diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index 01ff48f8..f634182c 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -21,7 +21,7 @@ namespace ballistica { // These are set automatically via script; don't modify them here. -const int kAppBuildNumber = 20382; +const int kAppBuildNumber = 20383; const char* kAppVersion = "1.6.4"; // Our standalone globals. diff --git a/src/ballistica/core/module.cc b/src/ballistica/core/module.cc index 053ddaec..ca98383a 100644 --- a/src/ballistica/core/module.cc +++ b/src/ballistica/core/module.cc @@ -21,6 +21,16 @@ void Module::PushRunnable(Runnable* runnable) { } } +auto Module::CheckPushSafety() -> bool { + if (std::this_thread::get_id() == thread()->thread_id()) { + // behave the same as the thread-message safety check for + // module messages. + return (runnables_.size() < kThreadMessageSafetyThreadhold); + } else { + return thread_->CheckPushModuleRunnableSafety(); + } +} + Module::Module(std::string name_in, Thread* thread_in) : thread_(thread_in), name_(std::move(name_in)) { id_ = thread_->RegisterModule(name_, this); diff --git a/src/ballistica/core/module.h b/src/ballistica/core/module.h index 4bcccf1c..fb79f9e9 100644 --- a/src/ballistica/core/module.h +++ b/src/ballistica/core/module.h @@ -21,35 +21,43 @@ class Module { /// Pass a Runnable that has been allocated with new(). /// There must be no existing strong refs to it. /// It will be owned and disposed of by the module from this point. - void PushRunnable(Runnable* runnable); + auto PushRunnable(Runnable* runnable) -> void; /// Convenience function to push a lambda as a runnable. template - void PushCall(const F& lambda) { + auto PushCall(const F& lambda) -> void { PushRunnable(NewLambdaRunnableRaw(lambda)); } + /// Returns true if there is plenty of buffer space available for + /// PushCall/PushRunnable; can be used to avoid buffer-full errors + /// by discarding non-essential calls. An example is calls scheduled + /// due to receiving unreliable network packets; without watching + /// buffer space it can be possible for an attacker to bring down + /// the app through a flood of packets. + auto CheckPushSafety() -> bool; + /// Return the thread this module is running on. auto thread() const -> Thread* { return thread_; } virtual ~Module(); /// Push a runnable from the same thread as the module. - void PushLocalRunnable(Runnable* runnable); + auto PushLocalRunnable(Runnable* runnable) -> void; /// Called for each module when its thread is about to be suspended /// (on platforms such as mobile). - virtual void HandleThreadPause() {} + virtual auto HandleThreadPause() -> void {} /// Called for each module when its thread is about to be resumed /// (on platforms such as mobile). - virtual void HandleThreadResume() {} + virtual auto HandleThreadResume() -> void {} /// Whether this module has pending runnables. auto has_pending_runnables() const -> bool { return !runnables_.empty(); } /// Used by the module's owner thread to let it do its thing. - void RunPendingRunnables(); + auto RunPendingRunnables() -> void; auto name() const -> const std::string& { return name_; } diff --git a/src/ballistica/core/thread.cc b/src/ballistica/core/thread.cc index 453dcc0b..c9130e1a 100644 --- a/src/ballistica/core/thread.cc +++ b/src/ballistica/core/thread.cc @@ -473,13 +473,9 @@ void Thread::LogThreadMessageTally() { break; } if (m.type == ThreadMessage::Type::kRunnable) { - // Runnable* e; - // e = static_cast(m.pval); - { - std::string m_name = g_platform->DemangleCXXSymbol( - typeid(*(static_cast(m.pval))).name()); - s += std::string(": ") + m_name; - } + std::string m_name = g_platform->DemangleCXXSymbol( + typeid(*(static_cast(m.pval))).name()); + s += std::string(": ") + m_name; } auto j = tally.find(s); if (j == tally.end()) { diff --git a/src/ballistica/core/thread.h b/src/ballistica/core/thread.h index cb940299..10ae2a3f 100644 --- a/src/ballistica/core/thread.h +++ b/src/ballistica/core/thread.h @@ -17,6 +17,8 @@ namespace ballistica { +const int kThreadMessageSafetyThreadhold{50}; + // A thread with a built-in event loop. class Thread { public: @@ -162,6 +164,12 @@ class Thread { Thread::ThreadMessage::Type::kRunnable, module_index, runnable)); } + auto CheckPushModuleRunnableSafety() -> bool { + // We first complain when we get to 1000 queued messages so + // let's consider things unsafe when we're halfway there. + return (thread_message_count_ < kThreadMessageSafetyThreadhold); + } + // Register a timer to run on the thread. auto NewTimer(millisecs_t length, bool repeat, const Object::Ref& runnable) -> Timer*; diff --git a/tools/batools/project.py b/tools/batools/project.py index 5e6d98b1..6c2ff34b 100755 --- a/tools/batools/project.py +++ b/tools/batools/project.py @@ -107,7 +107,7 @@ class Updater: # Docs checks/updates will only run if BA_ENABLE_DOCS_UPDATES=1 # is set in the environment. if os.environ.get('BA_ENABLE_DOCS_UPDATES') == '1': - self._update_docs_md() + self._update_docs() if self._check: print(f'{Clr.BLU}Check-Builds: Everything up to date.{Clr.RST}') @@ -673,7 +673,7 @@ class Updater: except Exception as exc: raise CleanError('Error checking/updating dummy module.') from exc - def _update_docs_md(self) -> None: + def _update_docs(self) -> None: # Update our docs/*.md files. # We need to do this near the end because it may run the cmake build # so its success may depend on the cmake build files having already @@ -683,4 +683,4 @@ class Updater: self._checkarglist, check=True) except Exception as exc: - raise CleanError('Error checking/updating docs') from exc + raise CleanError('Error checking/updating docs.') from exc