summaryrefslogtreecommitdiff
path: root/src/network/core
AgeCommit message (Collapse)Author
2021-05-29Codechange: rename str_validate to StrMakeValid(InPlace) (#9304)Patric Stout
This to be more explicit the function changes the value, and not returns yes/no.
2021-05-24Fix: Network on Haiku, remove old code for BeOSmilek7
2021-05-15Change: Use gender-neutral pronounsrubidium42
2021-05-15Fix: comparison of narrow type to wide type in loop (potential for infinite ↵Rubidium
loops)
2021-05-15Fix: [Network] Check on CIDR for netmask check considered everything validRubidium
2021-05-13Codechange: move passwords in settings to std::stringrubidium42
2021-05-13Codechange: [Network] split CloseSocket and CloseConnection more clearly (#9261)Patric Stout
* Codechange: [Network] split CloseSocket and CloseConnection more clearly - CloseSocket now closes the actual OS socket. - CloseConnection frees up the resources to just before CloseSocket. - dtors call CloseSocket / CloseConnection where needed.
2021-05-13Codechange: remove pointless close call due to resolving virtual functions ↵Rubidium
statically in destructors In the destructors of many of the network related classes Close() is called, just like the top class in that hierarchy. However, due to virtual functions getting resolved statically in the destructor it would always call the empty Close() of the top class. Document the other cases where a virtual call is resolved statically.
2021-05-13Fix #9255: [Network] TCPConnecter crashes when hostname not found (#9259)Patric Stout
2021-05-12Change: reworked the debug levels for network facility (#9251)Patric Stout
It now follows very simple rules: 0 - Fatal, user should know about this 1 - Error, but we are recovering 2 - Warning, wrong but okay if you don't know 3 - Info, information you might care about 4 - 5 - Debug #1 - High level debug messages 6 - Debug #2 - Low level debug messages 7 - Trace information
2021-05-11Fix: [Network] clients leaving because of broken connections was not ↵Patric Stout
broadcasted (#9238) The code mixed up "client has quit but we already told everyone" with "client lost connection, handle this". Split up those two signals: - CLIENT_QUIT means we told everyone and the connection is now dead - CONNECTION_LIST means we should tell everyone we lost a client
2021-05-10Change: reworded many of the network errors during connect/listen (#9230)Patric Stout
Also changed some levels to 0, as a failing listen() is something we should tell the user about. Hiding this information is a bit evil.
2021-05-08Fix: destroying a TCPConnecter that was still resolving made illegal writesPatric Stout
Basically, we should join the resolve thread before we destruct the object.
2021-05-08Codechange: move connection_string to private for TCPConnecterPatric Stout
The most common case never needs access to it anymore. Make the one exception to this explicit. This means the fact that we store it is now an implementation detail.
2021-05-08Fix f7e390bd: getpeername() doesn't work on closed sockets (#9213)Patric Stout
2021-05-06Feature: use Happy Eyeballs to make network connections (TCP-only) (#9199)Patric Stout
Hostnames like "content.openttd.org" resolve into multiple IPv4 and IPv6. It is possible that either of the IPs is not working, either due to a poorly configured OS (having IPv6 but no valid route), broken network paths, or a service that is temporary unavailable. Instead of trying the IPs one by one, waiting for a 3s timeout between each, be a bit more like browsers, and stack attempts on top of each other with slight delays. This is called Happy Eyebells. Initially, try the first IPv6 address. If within 250ms there is no connection yet, try the first IPv4 address. 250ms later, try the second IPv6 address, etc, till all addresses are tried. If any connection is created, abort all the other (pending) connections and use the one that is created. If all fail 3s after the last connect(), trigger a timeout for all.
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