Commit Graph
100 Commits
Author SHA1 Message Date
Lion Kortlepel e8ef7de4b9 fix a bug in TriggerLocalEvent which would cause the server to std::terminate()
it was refusing to push multiple return values onto a result table. Not
sure what changed to make this happen, but oh well.
2022-12-19 12:41:45 +01:00
Lion Kortlepel 8ea7b75874 fix sol assert not actually checking the assertion *facepalm* 2022-12-19 12:41:16 +01:00
Lion Kortlepel 59503ccc90 use a beammp_lua_errorf instead of a std::terminate on sol2 assertion failure 2022-12-19 11:52:22 +01:00
Lion Kortlepel 7316dff519 fix not removing client when disconnecting them 2022-11-25 14:40:21 +01:00
Lion Kortlepel b1a89125fe fix spinning a single thread in lua result check thread 2022-11-25 14:21:45 +01:00
Lion Kortlepel 4a6504ec2c fix "disconnect was called twice" error
this would cause players to stick around after being kicked
2022-11-23 09:34:51 +01:00
Lion Kortlepel b3594dd147 remove invalid naming of settings again
ive added this in what can only be described as complete delirium, as it
makes no sense whatsoever. reverted.
2022-11-23 09:34:51 +01:00
Lion Kortlepel 7cc426cb96 fix reading and defaulting the IncludeSubdirectories config option 2022-11-23 09:34:51 +01:00
Lion Kortlepel eaab5eaf30 fix crash which could happen when closing an invalid socket
for some reason boost::asio doesn't account for this and lets us simply
die when/if this happens.
2022-11-23 09:34:51 +01:00
Lion Kortlepel 35b38f35bb replace usages of ForEachClientWeak with ForEachClient 2022-11-23 09:34:51 +01:00
Lion Kortlepel 2572530957 ensure clients are valid when iterated over 2022-11-23 09:34:51 +01:00
Lion Kortlepel 8551e68184 fix bug which could cause multiple players to have the same ID (closes #154) 2022-11-23 09:34:51 +01:00
Lion Kortlepel 2f85c708c5 rework GetClient to use new ForEachClient, return shared_ptr
this simplifies a lot of functions, and removes a lot of potential
errors when using the function. You now only check whether the return
value is null, and if it's not, you have a valid, reference-counted,
client pointer.
2022-11-23 09:34:51 +01:00
Lion Kortlepel 844b64f5d9 rework ForEachClient to use concepts instead of SFINAE 2022-11-23 09:34:51 +01:00
Lion Kortlepel d7369c3bc5 deprecate ForEachClientWeak in favor of new ForEachClient 2022-11-23 09:34:51 +01:00
Lion Kortlepel a8ad9034b2 update lk-result 2022-11-23 09:34:50 +01:00
Lion Kortlepel b756ce3c3f fix formatting in all files 2022-11-23 09:34:50 +01:00
Lion Kortlepel 3f05b72cc2 change internal setting names to set apart categories 2022-11-23 09:34:50 +01:00
Lion Kortlepel 152393f8bf switch boost variant for std::variant for settings, for sol2 2022-11-23 09:34:50 +01:00
Lion Kortlepel dd36299436 add lk/result to includes 2022-11-23 09:34:50 +01:00
Lion Kortlepel da65e97ed1 add lk/result
a header-only library to deal with results
2022-11-23 09:34:50 +01:00
Lion Kortlepel 4cc163ea1c switch to c++20
this will allow us to use more convenience features of the language, and
leave more legacy code behind - also we can use c++20 libraries ;)
2022-11-23 09:34:50 +01:00
Lion Kortlepel 01bcc3d18c replace all clocks with a generic TimeType 2022-11-23 09:34:50 +01:00
Lion Kortlepel c7f6835702 use high_resolution_clock instead of system_clock 2022-11-23 09:34:50 +01:00
Lion Kortlepel 0327b41611 change to system_clock for times converted to time_t 2022-11-23 09:34:50 +01:00
Lion Kortlepel 48135f4544 add new onShutdown timing to changelog 2022-11-23 09:34:50 +01:00
Lion Kortlepel 0411ba533d change onShutdown to be called before all players are kicked 2022-11-23 09:34:50 +01:00
Lion Kortlepel 41dd4ff678 add version to changelog 2022-11-23 09:34:50 +01:00
Lion Kortlepel e1c2d0d5fb add version command 2022-11-23 09:34:50 +01:00
Lion Kortlepel 69c2868025 fix server not closing after detecting an invalid config (fixes #151) 2022-11-23 09:34:50 +01:00
Lion Kortlepel c8ca4564a1 fix error which complains about AuthKey not being present before reading the config file 2022-11-23 09:34:50 +01:00
Lion Kortlepel 0c6112c28a add boost to requirements in README for windows 2022-11-23 09:34:50 +01:00
Lion Kortlepel 4860849f2f add boost-uuid to vcpkg on windows 2022-11-23 09:34:50 +01:00
Lion Kortlepel 3bd67d959f handle all exceptions which happen inside a logging macro
and print them ;)
2022-11-23 09:34:50 +01:00
Lion Kortlepel 13a86d3e77 add explanative debug messages to parse errors in GetPidVid 2022-11-23 09:34:50 +01:00
Lion Kortlepel dff94a41be fix potential out of bounds exception in GetPidVid 2022-11-23 09:34:50 +01:00
Lion Kortlepel 79ee5915b4 fix unhandled out of bounds in Authentication 2022-11-23 09:34:50 +01:00
Lion Kortlepel 3fcf23977b fix fix for out-of-bounds crash, add disconnect messages to some failure conditions 2022-11-23 09:34:50 +01:00
Lion Kortlepel 487917482f fix out-of-range crash in SendFile
when the UnsafeName does not contain a `/`, the server would simply
crash, as an invalid substr() index was given, which triggered a
std::out_of_range.
2022-11-23 09:34:50 +01:00
Lion Kortlepel 2ca39a7368 fix cmakelists 2022-11-23 09:34:50 +01:00
Lion Kortlepel 6ebfe5743c add :Wait(timeout_s) function to the result of MP.TriggerGlobalEvent 2022-11-23 09:34:50 +01:00
Lion Kortlepel 3c138e2891 change date format from d/m/y to Y/m/d 2022-11-23 09:34:50 +01:00
Lion Kortlepel 2279ba4d6b attempt to report errors from event triggers 2022-11-23 09:34:50 +01:00
Lion Kortlepel 30b038a6bb revert adding nil to json
it causes issues, not worth it
2022-11-23 09:34:50 +01:00
Lion Kortlepel c39c7bb0a4 add scripts & dockerfiles to build on multiple platforms 2022-11-23 09:34:50 +01:00
Lion Kortlepel 06b238d63f remove unused code 2022-11-23 09:34:50 +01:00
Lion Kortlepel 1856dd2002 fix various little things in the json encode and decode 2022-11-23 09:34:50 +01:00
Lion Kortlepel b068a9b48f fix TriggerGlobalEvent not passing event arguments correctly (closes #106) 2022-11-23 09:34:50 +01:00
Lion Kortlepel e8d66ef983 add git hash to version print on startup
this helps us debug issues
2022-11-23 09:34:50 +01:00
Lion Kortlepel 7f47337e1b modify authkey notice to mention the possibility of entering an invalid key
this makes it clear that you may put anything as your key, as long as
you only want private servers.
2022-11-23 09:34:50 +01:00
Lion Kortlepel b0b4dc51b0 fix crash when the header of a TCP packet is negative 2022-11-23 09:34:50 +01:00
Lion Kortlepel 7abfae425d move around includes to satisfy the magical msvc 2022-11-23 09:34:50 +01:00
Lion Kortlepel 4791af4453 use system_clock::to_time_t instead of high_resolution_clock::* 2022-11-23 09:34:50 +01:00
Lion Kortlepel a44f9b3dba fix various build warnings and errors with clang++ 2022-11-23 09:34:50 +01:00
Lion Kortlepel c51d713969 add uuid source files
were missed last commit related to uuids
2022-11-23 09:34:50 +01:00
Lion Kortlepel 3781f2960a add debug to the changelog 2022-11-23 09:34:50 +01:00
Lion Kortlepel 9e469b04f1 add Util.GenerateUUID lua api
This api generates a pseudorandom RFC 4122 compliant UUID
(https://www.ietf.org/rfc/rfc4122.txt). It's pseudorandom, so it is
*unlikely* to have collisions.
2022-11-23 09:34:49 +01:00
Lion Kortlepel 96273e1d06 fix invalid include, reformat TConsole 2022-11-23 09:34:49 +01:00
Lion Kortlepel c717037895 add debug command to track statistics and debug client connections
The `debug` command shows info useful to develpers of the client and
server
2022-11-23 09:34:49 +01:00
Lion Kortlepel 692129cb81 add ToHumanReadableSize, which formats data sizes into MiB, GiB, etc.
this is needed in order to display data sizes in upcoming changes
related to tracking statistics about the server's performance
2022-11-23 09:34:49 +01:00
Lion Kortlepel 6842dccfc3 rework UDP recv loop, add packet statistics tracking
The UDPServerMain was badly designed and had multiple potential bugs and
unexpected & silent failures. The changes simplify the code here, and
tracks those unexpected failures in app-wide statistics. Also added,
while at that, some more tracking of how many packets and bytes are
sent & received per client
2022-11-23 09:34:49 +01:00
Lion Kortlepel e77dfd5a57 add boost to vcpkg requirements 2022-11-23 09:34:49 +01:00
Lion Kortlepel 54ad1c2715 add settings to changelog 2022-11-23 09:34:49 +01:00
Lion Kortlepel 48ce7c9721 add settings set/get/list/help console command
this makes use of the new settings-in-a-hashmap in order to make
changing any settings (except authkey) easy.
2022-11-23 09:34:49 +01:00
Lion Kortlepel 3aa6784627 bump version to 3.2.0 2022-11-23 09:34:49 +01:00
Lion Kortlepel bec09a4761 change settings to be a hash map instead of a fixed struct
this makes adding settings and changing settings incredibly easy, both
from the console and from lua.
2022-11-23 09:34:49 +01:00
Lion Kortlepel 7d35595683 potential fix for #141 2022-11-23 09:34:49 +01:00
Lion Kortlepel 982cbf116c potential fix to #141 2022-11-23 09:34:49 +01:00
Lion Kortlepel 43e70d80d2 fix dockerfie for archlinux 2022-11-23 09:34:49 +01:00
Lion Kortlepel 00a35a636c add scripts & dockerfiles to build on multiple platforms 2022-11-23 09:34:49 +01:00
Lion 47e64a7343 merge release candidate v3.1.1 (#142)
patches and hotfixes!
2022-10-31 11:32:16 +01:00
Lion Kortlepel 7f5b3919f4 make destructors of virtual classes virtual
this causes warnings in clang, and rightfully so :^)
2022-10-31 11:31:16 +01:00
Lion Kortlepel 896e777e23 update changelog 2022-10-31 11:31:16 +01:00
Lion Kortlepel aa58c1e211 another potential fix for #141 2022-10-31 11:31:15 +01:00
Lion Kortlepel 49a9226dca update changelog to mention fixes 2022-10-31 11:31:15 +01:00
Lion Kortlepel b10d5d0f4e fix empty events causing issues in the server
an empty event packet, if sent just right, could crash the server
2022-10-31 11:31:15 +01:00
Lion Kortlepel 5581fd1692 fix chat message impersonation issue
instead of using the supplied name, we ignore it entirely and use the
server's internal name for the client
2022-10-31 11:31:15 +01:00
Lion Kortlepel d36bb7962c ignore empty chat messages
this could happen with a malicious client of some kind, we should simply
ignore them
2022-10-31 11:31:15 +01:00
Lion Kortlepel 4e8bd993d5 remove J packet handler
it wasn't used by anything in the launcher, mod, or during the join
sequence, so i removed it for now.
2022-10-31 11:31:15 +01:00
Lion Kortlepel abff9bfbdb fix crash when chat message is malformed 2022-10-31 11:31:15 +01:00
Lion Kortlepel b024533f90 fix crash when the header of a TCP packet is negative 2022-10-31 11:31:15 +01:00
Lion Kortlepel f9251ff92c add more warning prints on unexpected cases 2022-10-31 11:31:15 +01:00
Lion Kortlepel 99f41c28cb fix #135 by making onPlayerDisconnect blocking, and calling it before removing the player
before, the handlers were not waited for, so the client was usually
destructed before lua got to the actual event handler call. Now, the
handler is called and waited on, and once all handlers are done, the
client is properly removed from the players internally, thus making
calls to GetPlayerName, GetPlayerIdentifiers, etc. return nil etc.
2022-10-31 11:31:15 +01:00
Lion Kortlepel bbd27c9cba fix formatting bug in status (closes #143) 2022-10-31 11:31:15 +01:00
Lion Kortlepel 4682922467 add more fixes for msvc static linking 2022-10-31 11:31:15 +01:00
Lion Kortlepel 83fb387dfe potential fix to #141 2022-10-31 11:31:09 +01:00
Lion Kortlepel 2b61f11a86 fix EnsureArgsCount not properly printing min/max 2022-10-31 11:24:13 +01:00
Lion Kortlepel a8b1a205f7 bump version to 3.1.1
I'm expecting to release a 3.1.1 with some fixes
2022-10-31 11:24:13 +01:00
Lion dd9376447a Fix README errors (#138) 2022-10-26 14:34:01 +02:00
Lion aa185afabf Update README.md 2022-10-23 03:35:39 +02:00
Lion e8caeb9126 merge release candidate v3.1.0 (#83)
See https://github.com/BeamMP/BeamMP-Server/blob/rc-v3.1.0/Changelog.md for
a list of changes
2022-10-22 23:24:48 +02:00
Lion Kortlepel fa1944dbef update readme to reflect dependency- and code-changes in 3.1.0 2022-10-22 23:22:42 +02:00
Lion Kortlepel 093f905fd8 remove redundant addition libboost library install in cmake-linux action 2022-10-22 23:06:11 +02:00
Lion Kortlepel 2a45d2282d update rc-v3.1.0 to master 2022-10-22 22:55:12 +02:00
Lion Kortlepel aeb024953a fix sentry line that caused build to fail 2022-10-22 22:48:23 +02:00
Lion Kortlepel 917c501faf fix typo causing beammp forum id not to show in identifiers (fix #137) 2022-10-22 21:16:31 +02:00
Lion Kortlepel 340933bbb3 fix dependencies for test run (add curl, fix ssl) 2022-10-22 21:01:44 +02:00
Lion Kortlepel a63359479e rename dependencies for test run in github actions 2022-10-22 20:44:47 +02:00
Lion Kortlepel bdf2da758c remove pps from heartbeat
"PPS has no meaning anymore and is completely irrelevant. You should
ignore it, it is not an indicator of ANYTHING. If it’s high, that means
NOTHING. If it’s low, that means NOTHING. If it’s -, that means
NOTHING."

It's packets per second per player per vehicle, but is only sent every
30 seconds, its not averaged, and on the client-side, it shows a ping
icon next to it.

A client can open a new connection to the server and send a `P`, and
measure the time to the `P` response packet. The connection is then
closed. This was added ages ago, please use this instead for ping :)
2022-10-17 14:05:51 +02:00
Lion Kortlepel 88c0ed56e4 add _WIN32_WINNT and move CRT no warnings flag 2022-10-17 12:25:13 +02:00