summaryrefslogtreecommitdiff
path: root/src/network/network_udp.cpp
AgeCommit message (Collapse)Author
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-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-06Codechange: [Network] Use std::string for NetworkGameInforubidium42
2021-05-06Codechange: [Network] Use new/delete instead of calloc/free for NetworkGameListrubidium42
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-05Codechange: [Network] Use a single NetworkServerGameInfo object at server ↵rubidium42
side and serialize that for the clients
2021-04-29Cleanup: remove write-only variable "hostname" in NetworkGameListPatric Stout
2021-04-27Codechange: refactor CheckGameCompatibility() from existing functionPatric Stout
Later commits use this function in other places too.
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-25Codechange: differentiate between UDP, TCP and compatibility MTU valuesRubidium
2021-04-24Codechange: move logic whether there is enough space in a packet to write ↵Rubidium
data into the Packet
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-12Fix: split the UDP blocking of sockets to only the socket involved, and when ↵Rubidium
another thread is busy do not attempt to process the packets of that socket
2021-04-12Change: move some things only relevant to UDP from network.cpp to ↵Rubidium
network_udp.cpp
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-06-21Fix: Thread unsafe use of NetworkAddress::GetAddressAsStringJonathan G Rennison
Remove static buffer form of NetworkAddress::GetAddressAsString. This is used in multiple threads concurrently, and is not thread-safe. Replace it with a form returning std::string.
2020-05-21Codechange: Replace custom linked list for GRF texts with STL vectors and ↵Michael Lutz
strings.
2019-12-21Codechange: Replace FOR_ALL_COMPANIES with range-based for loopsglx
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-04-10Codechange: Use null pointer literal instead of the NULL macroHenry Wilson
2019-04-06Codechange: Replace custom thread code with C++11 thread objects.Michael Lutz
We assume a conforming C++11 compiler environment that has a valid <thread>-header. Failure to run a real thread is handled gracefully.
2019-04-06Codechange: Replace custom mutex code with C++11 mutex'es.Michael Lutz
A conforming compiler with a valid <mutex>-header is expected. Most parts of the code assume that locking a mutex will never fail unexpectedly, which is generally true on all common platforms that don't just pretend to be C++11. The use of condition variables in driver code is checked.
2019-03-26Codechange: Replaced SmallVector::[Begin|End]() with std alternativesHenry 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-03Change: Make a shortened network revision string for use in server queriesNiels Martin Hansen
2016-10-30(svn r27670) -Add: [FS#6471] Assign descriptive names to (GNU pthread) ↵frosch
threads. (JGR)
2015-09-19(svn r27400) -Fix [FS#6368] (r26449): when a dedicated server was paused ↵rubidium
with no clients the tick length was increased significantly, making any assumptions about the tick length used further down in the code are not true anymore. One of such assumptions was that one should readvertise every 15 minutes worth of original ticks, but due to the lengthening this timeframe would be more like 45-60 minutes. Now we'll take the operating system's millisecond counter instead
2014-04-23(svn r26486) -Codechange: replace a number of snprintfs with seprintfrubidium
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-01-08(svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by ↵planetmaker
Eagle_rainbow)
2012-03-25(svn r24070) -Fix [FS#5098]: the 'last joined' server was not properly ↵rubidium
selected anymore (adf88)
2012-01-05(svn r23754) -Fix (r23752): the locks aren't reentrantrubidium
2012-01-04(svn r23752) -Fix [FS#4938]: missing locking causing crash is extreme case ↵rubidium
when being in the MP lobby
2012-01-04(svn r23751) -Codechange: rename NetworkUDPGameLoop to a more descriptive ↵rubidium
name, and move the UDP specific bits to network_udp
2011-12-11(svn r23494) -Feature: [NewGRF] action14 node INFO->URL_ to add an urlyexo
2011-07-30(svn r22695) -Fix [FS#4697]: mark addresses that could not be resolved as ↵rubidium
'do not resolve anymore' as well, instead of trying to resolve them each and every time the address is accessed
2011-05-04(svn r22423) -Document: some network stuffrubidium
2011-05-01(svn r22401) -Codechange: replace some defines in the udp code so doxygen ↵rubidium
can create better documentation
2011-03-03(svn r22162) -Fix [FS#4533]: No update of NewGRF window when unknown GRF ↵yexo
name becomes available
2010-12-11(svn r21463) -Fix [FS#4296] (r21405): when packets are filled their pos and ↵rubidium
size aren't the same as when they're read. As a check was incorrect.
2010-12-05(svn r21417) -Fix: ofcourse MSVC x64 has something to complain aboutrubidium
2010-12-05(svn r21405) -Codechange: prepare sending of company information in the UDP ↵rubidium
packet for longer company names (in bytes), by truncating the names if needed
2010-11-30(svn r21358) -Codechange: make some network function names conform to coding ↵rubidium
style
2010-10-17(svn r20957) -Codechange: Add another parameter to FindGRFConfig() to define ↵frosch
search restrictions.
2010-07-31(svn r20249) -Codechange: change the newgrf name/description from a char* to ↵yexo
a GRFText* to make translations possible
2010-07-24(svn r20211) -Codechange: Indented code should have curly braces around it.alberth