Commit Graph

1491 Commits (4ad6b1e58d3e2daa7c4654cd8b48d1d7c400d98a)

Author SHA1 Message Date
Michael Lutz b11bd185e3 Fix #9756: Network command unpack proc was not generated in all cases.
The case where the callback proc takes all command results but not any of
the command parameters was not handled properly.
3 years ago
Michael Lutz e67124e174 Change: [Admin] Bump admin port protocol due to command changes.
docs/admin_network.md promised that information in an admin packet
is never removed. It does allow the possibility of using a new packet type
for changed data in combination with a bump of the admin port version.

As the recent command handling changes modified the contents of
ADMIN_PACKET_SERVER_CMD_LOGGING, do exactly that.
3 years ago
Michael Lutz afc3d71fd0 Codechange: Don't generate CommandPacket unpack functions for invalid cmd/callback combinations.
If the arguments of the callback proc don't match with the command parameters,
we can't do the proper command execution anyway. As such, don't even generate
an unpack function in the first place, saving a bit of unnecessary code bloat.

Validate on receive that the cmd/callback combination is supported, rejecting
clients that try to send invalid values.
3 years ago
Michael Lutz 3e85e833a7 Codechange: Add support for additional command result values. 3 years ago
Michael Lutz 8503854655 Codechange: Pass unpacked command arguments to command callbacks (except Script). 3 years ago
Michael Lutz d85348b1d1 Codechange: Template the command callback function type to allow unpacked arguments. 3 years ago
Michael Lutz 13528bfcd0 Codechange: Un-bitstuff all remaining commands. 3 years ago
Michael Lutz 4f3ea3907e Codechange: Un-bitstuff commands taking a ClientID (i.e. CMD_CLIENT_ID). 3 years ago
Michael Lutz ccefa76a46 Codechange: Template DoCommandPInternal. 3 years ago
Michael Lutz 0f64ee5ce1 Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
3 years ago
Michael Lutz a05fd7aa50 Change: [Network] Transfer command data as serialized byte stream without fixed structure.
The data will be transmitted as the length followed by the serialized data. This allows the command
data to be different for every command type in the future.
3 years ago
Michael Lutz 123c7f99c3 Codechange: Move command callback declarations to the cmd header files. 3 years ago
Michael Lutz a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 3 years ago
Michael Lutz 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 3 years ago
Rubidium ad89601c49 Codechange: do not use all upper case enumerators in a scoped enum 3 years ago
Patric Stout ea4f6bb8b2
Fix #9730: [Network] connections can use an invalid socket due to a race condition
A race condition happens when an IPv6 connection takes more than
250ms to report an error, but does return before the IPv4 connection
is established.
In result, an invalid socket might be used for that connection.
3 years ago
Patric Stout 9c36c12c85
Codechange: ensure OnConnect() always gets called with a valid socket (#9729)
This should already be the case, but now assert()s will tell us
if this isn't.
3 years ago
Michael Lutz 8c558d74a5 Fix 55a11710: Curly braces need to be double-escaped for (std::)fmt. 3 years ago
dP 80e3397f85
Fix 3a1a915: Every 16th client never reconnects after server restart 3 years ago
glx22 1c0700e0c0 Fix #9624: compilation with RANDOM_DEBUG 3 years ago
Charles Pigott 3b7daca832
Change: Don't use 'server address' string in server list when displaying an invite code (#9615) 3 years ago
Patric Stout e4ad632989
Add: [Network] Keep the refresh button in lowered state while refreshing (#9600)
This gives user visual feedback that the refresh is still pending, and
prevents people from clicking again and again thinking nothing is
happening. This is especially true for connections that fall back to
TURN, as that takes a few seconds to kick in.

Additionally, prevent clicking on the button again while a refresh
is pending. This is only delaying a successful result.
3 years ago
dP 31cf9e888b
Add: [Network] external chat messages for remote admins (#9563) 3 years ago
Patric Stout d9f8ed7bdf
Add: [Network] On join, log the ClientID + IP + Name clearly (#9558)
Additionally, reword the disconnect to match connect / join messages.

Co-authored-by: Berbe <4251220+Berbe@users.noreply.github.com>
3 years ago
Patric Stout a8641ea44a
Add: support filtering content entries for patchpacks (#9541)
This changes nothing for us, but allows patchpacks to add the
right pieces of code to start filtering content entries on patchpack
only entries.
3 years ago
Jonathan G Rennison 6e3d023e69
Fix #9535: Maintain a reverse dependency map of network content (#9538)
Fixes performance issues with dependency lookup when retrieving
content list from the content server.
3 years ago
Patric Stout f656b0ae96
Fix: use-after-free after ClientNetworkCoordinatorSocketHandler::CloseAllConnections() (#9534)
The function clears all stun-handlers. This causes all of those
objects to be destroyed.
A handler can have a pending connecter, which was only killed in
case CloseConnection() was called. This is never the case when
the object is destroyed. In result, the connecter could finish
and cause a use-after-free by calling into the (now deleted)
handler.
3 years ago
Rubidium 92559e6f3a Fix #9388: thread unsafe use of NetworkAdminConsole/IConsolePrint 3 years ago
Patric Stout 63116bd59f
Fix a2051bad: SendCmdNames only sent one name per packet (#9528) 3 years ago
Patric Stout d8e870c50c
Fix: when DNS didn't resolve any IPs, the debug message was misleading (#9519) 3 years ago
Patric Stout dc5b7b996c
Fix: [Network] show query errors in the server listing instead of error popup (#9506)
When you are query several servers at once, it is rather unclear
for which server you got a popup. Instead, show any errors on the
server itself.

This is only true for the query-part. Joining a server still gives
an error popup to tell you about any issue.
3 years ago
Patric Stout e31b5d3870
Fix #9490: [Network] a full server couldn't be queried either (#9508)
You can now still query a full server, as long as the maximum
amount of allowed connections isn't reached. This means that as
long as there are not 255 clients connected to a server, you can
always connect to query.
3 years ago
Patric Stout b2f0491a90
Fix #9501: [Network] crash when more than one game-info query was pending (#9502) 3 years ago
Patric Stout 47ce306085
Fix c4b700f1: remove left-over debug statement (#9510) 3 years ago
Patric Stout 0d26359b5b
Fix: [Network] don't show GameScript " (v0)" for old servers (#9507)
Old servers don't tell the GameScript they are running, so nothing
should be shown.
All values in NetworkGameInfo initialize as 0/empty, except for GS
version. Someone has to be different from the rest, I guess.
3 years ago
Patric Stout 4066a07d8f
Fix: [Network] crash when last-joined server that is no longer available (#9503)
If you update the server-list while not having last-joined selected
and it is no longer available, the game crashed.
3 years ago
Michael Lutz fff09a4af2 Fix d9c1d18f2: Wrong format string for console disconnect message. 3 years ago
Patric Stout c4b700f1b0
Fix #9492: show for what server a relay session is being created (#9494)
Currently it says "the server" which is a bit ambigious. Be more
specific.
3 years ago
Patric Stout 5da60cef46
Fix: typo in the word "spectator" (tnx Heiki) (#9496) 3 years ago
Patric Stout 5c776f21e7
Fix 6acf204d: crash when showing coordinator-error-messages (#9488) 3 years ago
Patric Stout 6acf204d14
Fix: report reuse of invite-code and switch to local game-type (#9487)
This prevents two servers battling for the same invite-code. Now
the last one wins.
3 years ago
dP 2e6a77a78a
Fix: connecting with the same name thrice hangs the server (#9485) 3 years ago
Patric Stout 579f393374
Add: open Online Players GUI on starting/joining a server (#9479) 3 years ago
Patric Stout 1ef4d3cf19
Remove: COMPANY_INFO packets and related code (#9475) 3 years ago
Patric Stout 3d55ea2d4d
Feature: make "join game" button join the game, instead of first showing a lobby window (#9467)
Nobody really paid attention to the lobby window, and it completely
missed its purpose. Most people don't even wait for companies to
show up, but just hit "New Company".
This in turn means people create a lot of unneeded companies, while
they "just want to watch the game" or join another company.

Instead, "Join Game" now just joins the game as spectators.
3 years ago
Patric Stout db13eebf29
Fix 508e465b: network servers didn't show invite-code / connection-type in Online Players GUI (#9478)
The selector selects the first widget, which by accident was now only
the server visibility.
3 years ago
Patric Stout 508e465b59
Add: synchronize server name to clients and display in Online Players GUI (#9472) 3 years ago
Patric Stout 4c1ea4020d
Change: remove the ability to control "max spectators" (#9466)
Soon we will make "join game" join the game as spectator first,
so limiting the amount of spectators makes no sense anymore in
that context. Not sure it ever did make sense.
3 years ago
Rubidium ba29edb0b3 Cleanup: remove some references to the old master-server 3 years ago
Patric Stout 9cc706847c
Fix: crash when joining a server again after a TCP disconnect (#9453)
"my_client" wasn't always free'd when a game ended. "my_client"
keeps a reference inside the PT_NCLIENT pool. The rest of the
code assumes that when you are not in a game, it can freely
reset this pool.
In result: several ways to trigger a use-after-free.
3 years ago