Commit Graph

1434 Commits (16abdd52546eb3cfa9d51d674c41711c2c170029)

Author SHA1 Message Date
Patric Stout 29cceb59a5 Doc: explain in a bit more detail how we implemented STUN 3 years ago
Patric Stout 8adade26ed Feature: allow the use of STUN to connect client and server together
This method doesn't require port-forwarding to be used, and works for
most common NAT routers in home setups. But, for sure it doesn't work
for all setups, and not everyone will be able to use this.
3 years ago
Patric Stout 55eed246b8 Codechange: allow Connect() to bind to a local address 3 years ago
Patric Stout c921f6d817
Add: inform clients what game-script a server is running (#9441)
Co-authored-by: The Dude <thedude@novapolis.net>
3 years ago
Patric Stout dd7f69be6e
Fix: "Search LAN games" used the socket after it was closed (#9437)
Every outgoing connection, either TCP or UDP, triggered
NetworkInitialize(), which triggered NetworkUDPInitialize() which
first closes all connections.

Now the problem was that "Search LAN games" found a server, added
it to the list, after which (over TCP) it queries the server. This
closes all UDP sockets (as that makes sense, I guess?), while the
UDP was still reading from it.

Solve this by simply stop initializing UDP every time we make an
outgoing TCP connection; instead only do it on start-up.
3 years ago
Rubidium 178ea3196b Remove: includes to network/core/config.h from headers when only three cpp files need it 3 years ago
Patric Stout b6a116a247
Add: allow setting your server visibility to "invite-only" (#9434)
In this mode you do register to the Game Coordinator, but your
server will not show up in the public server listing. You can give
your friends the invite code of the server with which they can
join.
3 years ago
Patric Stout e4d216e44b Feature: join servers based on their invite code
This removes the need to know a server IP to join it. Invite codes
are small (~7 characters) indentifiers for servers, which can be
exchanged with other players to join the servers.
3 years ago
Patric Stout 1baec41542 Change: groundwork to allow ServerAddress to use invite codes
Normally TCPConnecter will do a DNS resolving of the connection_string
and connect to it. But for SERVER_ADDRESS_INVITE_CODE this is different:
the Game Coordinator does the "resolving".

This means we need to allow TCPConnecter to not setup a connection
and allow it to be told when a connection has been setup by an external
(to TCPConnecter) part of the code. We do this by telling the (active)
socket for the connection.

This means the rest of the code doesn't need to know the TCPConnecter
is not doing a simple resolve+connect. The rest of the code only
cares the connection is established; not how it was established.
3 years ago
Patric Stout cee8174d02 Codechange: track servers with a ServerAddress instead of a NetworkAddress
This allows future extensions to have different ways of referencing
a server, instead of forcing to use IP:port.
3 years ago
Patric Stout f4dd2d88c7 Feature: raise the maximum NewGRF limit to 255 3 years ago
Rubidium e99134654b Feature: allow setting (game) coordinator and content server connection strings using environment variables
OTTD_COORDINATOR_CS for the game coordinator defaults to coordinator.openttd.org:3976
OTTD_CONTENT_SERVER_CS for the content server defaults to content.openttd.org:3978
OTTD_CONTENT_MIRROR_CS for the content mirror server defaults to binaries.openttd.org:80
3 years ago
Patric Stout de7ab2eb1c Cleanup: remove unused optional ctor parameter for NetworkGameList 3 years ago
Patric Stout 6212d0a8da Remove: unused UDP protocol parts 3 years ago
Patric Stout 8a2da49413 Remove: old server listing via Master Server
This removes all UDP from the game except for a local broadcast
to find LAN games.

So long Master Server, and tnx for all the fish!
3 years ago
Patric Stout 61fdef8457 Remove: old server announcement to Master Server
As we now use the Game Coordinator for announcements, there is no
longer a need to use the Master Server for this.
3 years ago
Patric Stout aa93d76223 Add: use Game Coordinator to get latest public server listing 3 years ago
Patric Stout b1280fd17e Add: use Game Coordinator to annouce public servers 3 years ago
Patric Stout e1e2212e0e Codechange: track version of network servers to prune once out-of-date 3 years ago
Patric Stout cbaac5609f Codechange: use UpdateNetworkGameWindow() over manually marking window dirty 3 years ago
Stephan a70aa5df49
Add #9188: netsave now keeps multiple version around, similar to autosave (#9395) 3 years ago
Patric Stout 852e056d6f
Fix 9e32c618: network revision was always empty (#9419)
Shadowing the variable you intend to write in tends to do that ;)
3 years ago
Patric Stout d38079d053
Fix f7e390bd: freeaddrinfo() is not guaranteed to handle a nullptr graceful (#9404) 3 years ago
TELK f9b4a3a5e6
Add: Show the number of clients and companies in the online players window (#9376) 3 years ago
rubidium42 cdf9caf8ea Codechange: [Network] Remove overload on NetworkValidateClientName
Rename the zero-parameter NetworkValidateClientName to NetworkValidateOurClientName to make it clearer it is performed on our client name, and to make it a non-overloaded function to aid with the variant being added a few commits later
3 years ago
Rubidium f904aef176 Cleanup: use nullptr instead of 0 or NULL 3 years ago
SamuXarick d0bcb9839a
Fix: you could join an AI company in multiplayer via the GUI (#9369) 3 years ago
rubidium42 05005dcdfa Codechange: [Network] Use std::string instead of char[] for the name of the file that is downloading 3 years ago
rubidium42 981cd0197a Codechange: [Network] Use std::string for the client name in the network server 3 years ago
rubidium42 a8b3afb236 Codechange: [Network] Use string_view for network compatability check 3 years ago
rubidium42 49dcf0c772 Codechange: [Network] Simplify constructing the HTTP request with fmt 3 years ago
rubidium42 53b4786037 Codechange: [Network] Let NetworkError return its std::string instead of a C-string 3 years ago
rubidium42 667301e3ec Codechange: [Network] Make hostname/client IP return strings instead of a C-string 3 years ago
rubidium42 a91e29b656 Codechange: [Network] Let IsInNetmask use std::string 3 years ago
rubidium42 36705f1dc0 Codechange: [Network] Simplify formatting of network addresses to string 3 years ago
rubidium42 9e32c618f9 Fix: [Network] Determining GetNetworkRevisionString could overflow and underflow its buffer
Tagged releases are not affected
3 years ago
rubidium42 eb6cdadc4d Codechange: replace IConsolePrintF with IConsolePrint and fmt formatting
Also make some strings more consistent with the rest of the console strings.
3 years ago
rubidium42 d9c1d18f2b Change: improve some of the console messages related to networking (make them more uniform) and convert to fmt 3 years ago
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 3 years ago
rubidium42 845fded2a0 Fix #9361, a2051ba: [Network] Off by one in CanWriteToPacket
Previously it did not allow writing a byte to a packet that was of size limit - 1 anymore.
3 years ago
TELK 2d0abf5a76
Fix #9362: Hover in online players window was slightly too big (#9364)
This causes graphical glitches at the bottom of the window.
3 years ago
rubidium42 bb8fd00760 Cleanup: [Network] Remove C-string Recv_string and its last use 3 years ago
rubidium42 ab9b937ab7 Codechange: [Network] Use std::string to get a NewGRF's name 3 years ago
rubidium42 e2417193c9 Cleanup: [ContentInfo] Remove some functions that are not needed anymore 3 years ago
rubidium42 e3717ae903 Codechange: [ContentInfo] Use std::string instead of string buffers 3 years ago
rubidium42 df181bb641 Codechange: [ContentInfo] Use a vector for dependencies instead of custom allocation 3 years ago
rubidium42 9c424ab741 Codechange: [ContentInfo] Use StringList for tags instead of custom allocations 3 years ago
rubidium42 dfb89f3891 Codechange: [ContentInfo] Do not use memset/memcpy to make it possible to use vector/string 3 years ago
rubidium42 6bb3f034e4 Cleanup: [ContentInfo] Remove unused function 3 years ago
Patric Stout 5e44da3010
Fix ef991b17: server was trying to free() a packet created with "new CommandPacket()" (#9334) 3 years ago