summaryrefslogtreecommitdiff
path: root/src/network/network_content.cpp
AgeCommit message (Collapse)Author
2021-06-10Cleanup: [ContentInfo] Remove some functions that are not needed anymorerubidium42
2021-06-10Codechange: [ContentInfo] Use std::string instead of string buffersrubidium42
2021-06-10Codechange: [ContentInfo] Use a vector for dependencies instead of custom ↵rubidium42
allocation
2021-06-10Codechange: [ContentInfo] Use StringList for tags instead of custom allocationsrubidium42
2021-05-29Codechange: Rename window related DeleteXXX to match new behaviourglx22
2021-05-27Fix: do not hide parameter by local variable with the same namerubidium42
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-10Fix: leaking file descriptorsRubidium
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-04-25Change: use 32 KiB packets to send requests to the content serverRubidium
2021-04-25Codechange: differentiate between UDP, TCP and compatibility MTU valuesRubidium
2021-04-24Codechange: encapsulate writing data from Packets into sockets/files/buffers ↵Rubidium
to prevent packet state modifications outside of the Packet
2021-02-27Codechange: [Network] replace _realtime_tick with std::chronoPatric Stout
2021-01-08Fix: Start the inactivity-timeout for the content server only after the ↵frosch
connection has been established. (#8530) When connecting took long due to the first N resolve-addresses timing out, OpenTTD would immediately close the connection, without sending anything.
2021-01-08Codechange: Remove min/max functions in favour of STL variants (#8502)Charles Pigott
2020-12-27Fix b408fe7: Don't try to construct a std::string from nullptrCharles Pigott
2020-12-27Codechange: Even more std::string usage in file IO.Michael Lutz
2020-12-27Codechange: Use std::string in FIO search path handling.Michael Lutz
2020-12-15Fix: Remove unnessary reference to suppress warning (#8337)Byoungchan Lee
Apple Clang version 12 (bundled with Xcode 12) complaints about copying small objects in range loop (-Wrange-loop-analysis introduced by -Wall). This warning can be easily avoided by removing the reference from the const pointer type.
2020-12-15Add: support for emscripten (play-OpenTTD-in-the-browser)Patric Stout
Emscripten compiles to WASM, which can be loaded via HTML / JavaScript. This allows you to play OpenTTD inside a browser. Co-authored-by: milek7 <me@milek7.pl>
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-09-29Fix: Some typos found using codespellJMcKiern
2019-05-04Codechange: replace grow() usage in ↵glx
ClientNetworkContentSocketHandler::OnReceiveData()
2019-04-10Codechange: Use null pointer literal instead of the NULL macroHenry Wilson
2019-04-09Fix: Crash due to use of invalid iterator in ClientNetworkContentSocketHandlerJonathan G Rennison
In particular this crash can be observed when using the bootstrap GUI to download the base graphics. In ClientNetworkContentSocketHandler::OnReceiveContentInfo ClientNetworkContentSocketHandler::callbacks is iterated, using an iterator cb->OnReceiveContentInfo() is called (cb is of type BootstrapAskForDownloadWindow) This calls new BootstrapContentDownloadStatusWindow() This inherits from BaseNetworkContentDownloadStatusWindow The constructor of which calls _network_content_client.AddCallback(this) This reallocates the std::vector which is being iterated in ClientNetworkContentSocketHandler::OnReceiveContentInfo This results in iter being invalid, and an assertion failure occurs shortly afterwards due to its use in the next iteration of cb->OnReceiveContentInfo() Adjust all locations where ClientNetworkContentSocketHandler::callbacks is iterated to avoid problematic behaviour
2019-03-28Fix: MSVC warnings (#7423)glx22
2019-03-26Codechange: Replaced SmallVector::[Begin|End]() with std alternativesHenry Wilson
2019-03-26Codechange: Replaced SmallVector::Include() with include()Henry Wilson
2019-03-26Codechange: Replaced SmallVector::Append() with ↵Henry Wilson
std::vector::[push|emplace]_back()
2019-03-26Codechange: Replaced SmallVector::Contains() with std::find() patternHenry Wilson
2019-03-26Codechange: Replaced SmallVector::Reset() with std::vector::clear() + ↵Henry Wilson
shrink_to_fit()
2019-03-26Codechange: Replace SmallVector::Length() with std::vector::size()Henry Wilson
2019-03-26Codechange: Replace SmallVector::Clear() with std::vector::clear()Henry Wilson
2019-03-24Codechange: Use override keyword in networking classes.peter1138
2019-03-20Remove: ENABLE_NETWORK switchPatric Stout
This switch has been a pain for years. Often disabling broke compilation, as no developer compiles OpenTTD without, neither do any of our official binaries. Additionaly, it has grown so hugely in our codebase, that it clearly shows that the current solution was a poor one. 350+ instances of "#ifdef ENABLE_NETWORK" were in the code, of which only ~30 in the networking code itself. The rest were all around the code to do the right thing, from GUI to NewGRF. A more proper solution would be to stub all the functions, and make sure the rest of the code can simply assume network is available. This was also partially done, and most variables were correct if networking was disabled. Despite that, often the #ifdefs were still used. With the recent removal of DOS, there is also no platform anymore which we support where networking isn't working out-of-the-box. All in all, it is time to remove the ENABLE_NETWORK switch. No replacement is planned, but if you feel we really need this option, we welcome any Pull Request which implements this in a way that doesn't crawl through the code like this diff shows we used to.
2019-02-06Fix fdc2e85: Double close of file handlesNiels Martin Hansen
When unpacking downloaded content, the downloaded .gz file was being opened with `fopen`, the OS file handle given to zlib, and then afterwards zlib told to close the file. But the `FILE *` object was never closed with `fclose`, meaning the stdio library would have a hanging file object, whose file handle was now invalid or referred to a different file. This caused asserts during shutdown with Microsoft's C library in debug mode. Fix this by properly duplicating the OS handle and `fclose`ing the `FILE *` object, before giving the handle to zlib.
2016-05-22(svn r27576) -Fix (r27570): Compilation failure with all compilers but mine.frosch
2016-05-22(svn r27570) -Fix [FS#6449]: Various incorrect but uncritical size ↵frosch
computations in the content client.
2014-04-23(svn r26489) -Codechange: properly account for the end of buffers in the ↵rubidium
file io code instead of assuming MAX_PATH is okay
2014-04-23(svn r26482) -Codechange: add an include that allows us to undefine/redefine ↵rubidium
"unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values
2013-11-22(svn r26056) -Fix: a number of possibly uninitialised variablesrubidium
2013-11-22(svn r26047) -Fix: possible, but very unlikely, null pointer dereference ↵rubidium
when gunziping just downloaded files
2013-07-13(svn r25597) -Fix [FS#5635]: [Content] When the server closed the ↵rubidium
connection, the client would for eternity try to read a packet and never timeout making it impossible to reconnect
2013-01-08(svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by ↵planetmaker
Eagle_rainbow)
2012-08-13(svn r24466) -Codechange [FS#5236]: add general function for ContentType -> ↵yexo
Subdirectory conversion (LordAro)
2012-01-02(svn r23719) -Fix [FS#4930]: extraction of music packs failedrubidium
2011-12-19(svn r23612) -Add: allow importing libraries in the same way as AI does, ↵truebrain
only with GS prefix (and in game/library)
2011-12-19(svn r23605) -Add: GAME_DIR and CONTENT_TYPE_GAME, and read gamescript from ↵truebrain
that directory
2011-12-19(svn r23601) -Fix: fix the conflict in window numbertruebrain