When using the lobby, after constructing `CNetServer` the public IP has
to be queried. The consructor knows whether the lobby is used, so do it
in the constructor.
The init-attributes can only be changed before the worker runs. It isn't
used before the worker runs. This changes it so that it has to be passed
when the server starts.
With this the `m_InitAttributesQueue` can be removed.
It has to be called before `SetupConnection` is called. Now the
server-data is setup during the constructor.
When connecting using the lobby, the data isn't known at construction
time. Then it is done at the start of `TryToConnectWithSTUN`.
CNetClient and CNetServer are constructed for a single match. The
password of a game can not be changed after creating the match. When the
password is passed to the constructor it's not possible to invoke the
functions in the wrong order and the `ENSURE` can be "checked at
compile-time" so to say.
This reduces the stutter when a client joins.
The decompression isn't put on the task manager. As the client would
have to wait for that either way. Also a new polling loop would have to
be introduced.
The compression code is moved to the file transferer so all data send
through it gits compressed.
Refs: #4210
It's better to construct a js-array from a `JS::RootedValueVector`.
Because it is more strongly typed and the index doesn't has to be
specified when appending an element.
Some usages are replaced with `JS::RootedValueArray`.
Fixes: #8702
All functions had a `LDR_` prefix. The prefix is removed.
Functions and globals which are only used in Loader.cpp are now
contained in an anonymous namespace.
When a patch version is released, it must declare compatibility with the
previous patch versions of the same main release. This allows players to
keep replaying their games and to keep playing online with users of
other patches of the same main release.
This should have anticipated for dae7a8c394
Patch by @elexis.
The package sent in fa85527baf / #2420 plus this missing return causes the NetServerTurnManager
to be stalled forever if a client succeeds to send this package on disconnect.
In NotifyFinishedClientCommands, Disconnect calls OnDisconnect calls UninitialiseClient calls m_ClientsData.erase,
but then m_ClientsData[client].readyTurn = turn; reinserts the disconnected client, making the turnmanager wait forever for the disconnected client.
refs https://wildfiregames.com/forum/topic/134742-bug-game-incredibly-slowfreeze-at-start-because-because-of-1-player/
The first header was used to include the SpiderMonkey JS API at once,
with safeguards and preprocessor defines. Nowadays, SpiderMonkey
provides modular headers allowing us to include what we use, refs #8086.
Some defines have to be moved to compiler options but it is apparently
a mistake from the SM developers:
https://bugzilla.mozilla.org/show_bug.cgi?id=1987876
With C++20 the custom container PS:span, which was a backport of
std::span is no longer needed.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Make include-what-you-use happy with some files in source and fix what
needs to be fixed.
Add markers to precompiled.h header includes to avoid
include-what-you-use wanting them to be removed.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Make include-what-you-use happy with some files in source and fix what
needs to be fixed.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
While std::is_pod is required it is not sufficient so use
std::is_integral as condition which is.
Further replace the static_assert with a requires and use the new endian
support to avoid use preprocessor.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
std::is_pod is deprecated in C++20 and as such triggers
-Wdeprecated-declarations when built with C++20, "is_standard_layout &&
is_trivial" is the equivalent, so migrate to that.
While at it replace runtime dispatch with compile time and reduce the
required trait for memcpy to what is really needed.
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Make include-what-you-use happy with files in source/network and
fix what needs to be fixed.
Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Previously the param type was `void*` now the type has to be specified
as template parameter of the `CFsm`.
With this commit some casts can be removed.
Shrinking GCs dump the JITted code, which leads to redundant recompilations, lowers performance, and makes profiling JS more difficult.
They may still happen if the runtime is at risk of OOM.
Add a unique disconnect reason for timeouts of connection attempts.
Rewrite the displayed error message and provide a link directly to the FAQ entry.
(The old message was very misleading and only brought players on the
wrong track during troubleshooting)
The UPnP implementation included a combination of two subtle bugs, which
resulted in failure to create port forwardings every time after the
first one.
When using UPnP, the internet gateway to create the port forwardings at
needs to discovered. As that takes a while, the its root descriptor URL
was supposed to be cached after successful discovery in the user config
in "network.upnprootdescurl". However, instead of caching the root
descriptor URL, the control URL got cached. That caused following
requests to the root descriptor URL to fail, as they ended up at the
control URL instead. As such requests might also fail when the network
topology changed, the code was supposed to fall back to discovering the
internet gateway again when the cached one didn't work. However, due to
the inner workings of miniupnpc the request using the cached root
descriptor URL didn't result in an error, so the new discovery was never
triggered. As the wrong value was persisted in the user config there was
also no way to get out of this situation again.
This commit fixes both of these bugs.
As far as I can tell these bugs existed since the introduction of the
caching of the root descriptor URL in 0ba25e9968, which means creating
port forwardings using UPnP has been broken since Alpha 15.