summaryrefslogtreecommitdiff
path: root/src/network/core
AgeCommit message (Collapse)Author
2021-05-06Codechange: [Network] Use std::string for NetworkGameInforubidium42
2021-05-06Codechange: [Network] Use std::string for NetworkAddress' host namerubidium42
2021-05-05Codechange: use connection_string in favour of NetworkAddress (#9197)Patric Stout
We now resolve the connection_string to a NetworkAddress in a much later state. This means there are fewer places constructing a NetworkAddress. The main benefit of this is in later PRs that introduce different types of NetworkAddresses. Storing this in things like NetworkGameList is rather complex, especially as NetworkAddress has to be mutable at all times. Additionally, the NetworkAddress is a complex object to store simple information: how to connect to this server.
2021-05-05Cleanup: [Network] Remove variable from NetworkGameInfo that is only used ↵Rubidium
during deserialisation
2021-05-05Change: [Network] Update server's NetworkServerGameInfo only when neededrubidium42
Split the updating in a "static" version that only needs to be called when a new map is loaded or some settings are changed, and a "dynamic" version that updates everything that changes regularly such as the current game date or the number of spectators.
2021-05-05Codechange: [Network] Use a single NetworkServerGameInfo object at server ↵rubidium42
side and serialize that for the clients
2021-05-03Add: [Network] Reading std::string from a packetrubidium42
2021-05-03Add: [Network] Writing std::string to a packetrubidium42
2021-05-01Codechange: move some OS abstraction method implementations out of the headerrubidium42
2021-05-01Codechange: encapsulate network error handlingrubidium42
2021-05-01Codechange: rename NetworkError to ShowNetworkErrorrubidium42
2021-04-29Change: [Network] Encapsulate logic about the connection string to the ↵rubidium42
network code (#23)
2021-04-29Codechange: use NetworkAddress instead of two host/port variables where possiblePatric Stout
This also means we no longer need last_host/last_port, but can just use a single last_joined setting.
2021-04-29Codechange: use std::string over stack-based strings if possiblePatric Stout
2021-04-29Cleanup: remove write-only variable "hostname" in NetworkGameListPatric Stout
2021-04-28Fix b3003dd1: swap SERVER_GAME_INFO with CLIENT_GAME_INFO (#9129)Patric Stout
The idea is that if you query an older server that does not support this packet yet, the client receives an error. The assumption was that on every "illegal packet" the connection would be closed. This turns out to be false. Now CLIENT_GAME_INFO aligns with the old PACKET_CLIENT_NEWGRFS_CHECKED, which does a pre-check (which fails), and an error is sent back and the connection is closed. This is not a nice solution, but it is the best we got.
2021-04-27Fix: missing <limits> include in network/core/packet.h (#9123)Milek7
2021-04-27Codechange: refactor CheckGameCompatibility() from existing functionPatric Stout
Later commits use this function in other places too.
2021-04-27Add: ability to retrieve game info from server over TCPPatric Stout
2021-04-27Codechange: be explicit in pointer comparisonsPatric Stout
2021-04-27Codechange: move all NetworkGameInfo related functions to a single filePatric Stout
It currently was a bit scattered over the place. Part of NetworkGameInfo is also the GRF Identifiers that goes with it.
2021-04-27Change: [Network] lower TCP connect() timeout to 3s (#9112)Patric Stout
Currently we use default OS timeout for TCP connections, which is around 30s. 99% of the users will never notice this, but there are a few cases where this is an issue: - If you have a broken IPv6 connection, using Content Service is first tried over IPv6. Only after 30s it times out and tries IPv4. Nobody is waiting for that 30s. - Upcoming STUN support has several methods of establishing a connection between client and server. This requires feedback from connect() to know if any method worked (they have to be tried one by one). With 30s, this would take a very long time. What is good to mention, is that there is no good value here. Any value will have edge-cases where the experience is suboptimal. But with 3s we support most of the stable connections, and if it fails, the user can just retry. On the other side of the spectrum, with 30s, it means the user has no possibility to use the service. So worst case we annoy a few users with them having the retry vs annoying a few users which have no means of resolving the situation.
2021-04-27Cleanup: remove #ifdefs for compiling the old content serverrubidium42
2021-04-27Codechange: [Network] Do not leak os_abstraction.h via fios.hrubidium42
2021-04-27Change: [Network] Use string error messages instead of numeric error numbers ↵rubidium42
that need to be looked up
2021-04-27Fix: [Network] errno and strerror do not handle network errors on Windowsrubidium42
2021-04-26Fix 8a95fee4: Missing initialiser in Packet constructorCharles Pigott
2021-04-25Change: use 32 KiB packets to transfer the savegameRubidium
2021-04-25Codechange: differentiate between UDP, TCP and compatibility MTU valuesRubidium
2021-04-25Codechange: allow different limits in packet sizesRubidium
2021-04-24Codechange: use std::vector instead of a fixed size array for PacketsRubidium
2021-04-24Codechange: add accessor for the packet type to Packet and make the internal ↵Rubidium
state of Packet private
2021-04-24Codechange: remove public access to the next pointer in PacketRubidium
2021-04-24Codechange: encapsulate reading the size of a PacketRubidium
2021-04-24Codechange: encapsulate the logic about how many bytes can be sent from a ↵Rubidium
buffer in to a Packet
2021-04-24Codechange: move the logic shrinking of the packets into the Packet itselfRubidium
2021-04-24Codechange: encapsulate writing data from Packets into sockets/files/buffers ↵Rubidium
to prevent packet state modifications outside of the Packet
2021-04-24Codechange: encapsulate reading data from sockets into Packets to prevent ↵Rubidium
packet state modifications outside of the Packet
2021-04-24Codechange: move logic whether there is enough space in a packet to write ↵Rubidium
data into the Packet
2021-04-24Codechange: move more logic about packet size validity and reading into PacketRubidium
2021-04-20Doc: server name doesn't need to be advertised to be validPatric Stout
Strictly seen the comment is true, as it says 'e.g.', but it is misleading. The server name is just that: the name of the server as configured. No need to mention advertising.
2021-04-20Codechange: remove always-empty "address" from NetworkContentSocketHandlerPatric Stout
When ever you saw this debug lines (which you never should), they showed an empty address. It is also not very useful to have, as it always points to a known server anyway.
2021-04-20Codechange: split ParseConnectionString into two functionsPatric Stout
One also looks for a company, the other doesn't. There were more uses of the latter than the first, leaving very weird code all over the place.
2021-04-20Remove: "language" field from server/clientPatric Stout
The original idea was that people could find a server they could talk in their native language on. This isn't really used in that way. There are several reasons for removing this: - the client also sends his "language" to the server, but nothing is doing anything with this. - flags are a bad way to represent languages, and over the years we had several (rightfully) complaints about this. - most servers have their language set to "All", and prefix the servername with the language it is about. This is a much more efficient way to do the same. All in all, this feature should go back to the drawing board. Maybe it could work in another form, but this form is not it.
2021-04-20Remove: "map_name" from server announcements / listingPatric Stout
The idea back in the days was nice, but it never resulted in anything useful. Most servers either read "(loaded game)" or "Random Map", neither being useful. It was meant for heightmaps, so you could find a server that was using a specific one .. but there are many things wrong with that idea. Mostly, servers tend to save and load savegames from time to time, after which the original heightmap used was lost. All in all, removing map_name all together is just better.
2021-04-12Change: warn the user about the resolving of an address being extra very slowRubidium
2021-04-07Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of ↵Niels Martin Hansen
static buffers
2021-02-27Codechange: [Network] replace _realtime_tick with std::chronoPatric Stout
2021-01-08Codechange: Remove min/max functions in favour of STL variants (#8502)Charles Pigott
2020-12-27Codechange: Replace assert_compile macro with static_assertCharles Pigott