summaryrefslogtreecommitdiff
path: root/src/network/core/address.cpp
AgeCommit message (Collapse)Author
2021-05-01Codechange: encapsulate network error handlingrubidium42
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-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-27Fix: [Network] errno and strerror do not handle network errors on Windowsrubidium42
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
2020-12-15Fix: workarounds for two emscripten bugs in the network stackPatric Stout
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>
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.
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-04-10Codechange: Use null pointer literal instead of the NULL macroHenry Wilson
2019-04-09Codechange: If something is a vector of strings, use a vector of strings ↵Michael Lutz
instead of an AutoFreeSmallVector.
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.
2014-12-24(svn r27092) -Fix/Add [FS#6186]: Compilation on OS/2 (smedles)frosch
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)
2011-11-12(svn r23193) -Codechange: don't cast away const unneededlyrubidium
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-01-22(svn r21886) -Codechange: move documentation towards the code to make it ↵rubidium
more likely to be updated [n].
2010-10-16(svn r20951) -Codechange: Add SmallMap::Contains() and use it.frosch
2010-03-11(svn r19385) -Fix [FS#3684]: [IPv6] Netmask calculations were wrong if cidr ↵rubidium
>= 32.
2009-10-04(svn r17693) -Cleanup: remove some unneeded includesrubidium
2009-08-21(svn r17248) -Fix: add GPL license notice where appropriaterubidium
2009-05-10(svn r16265) -Fix (r16238): wrong format string for debug outputsmatz
2009-05-06(svn r16238) -Change: improve/clarify some network related debug "error" ↵rubidium
messages by adding more information to them. Also give some clues on how to fix certain issues (like failing advertising).
2009-04-11(svn r16034) -Fix: compile warnings generated by 64 bits MSVC.rubidium
2009-04-10(svn r16007) -Fix (r16004): when we want to bind to both IPv4 and IPv6, make ↵rubidium
the master socket do that too; too bad getaddrinfo can't handle binding to any address on any port at the same time :(
2009-04-09(svn r16005) -Fix: assertion when there is no last joined server; when ↵rubidium
you've got an unresolved address, the hostname cannot be resolved either so return it as-is.
2009-04-09(svn r16004) -Fix (r16000): explicitly binding to an IPv4 socket would try ↵rubidium
to register an IPv6 address (only if it could ofcourse)
2009-04-08(svn r15990) -Codechange: provide a thread safe variant of GetAddressAsString.rubidium
2009-04-08(svn r15984) -Codechange: prepare the UDP receiver to process multiple types ↵rubidium
of returned server lists.
2009-04-08(svn r15982) -Codechange: use GetAddressAsString to get the name instead of ↵rubidium
passing the hostname and the IP into a string.
2009-04-08(svn r15981) -Fix: don't print the address family when writing the IP+port ↵rubidium
to the config file.
2009-04-08(svn r15980) -Codechange: don't try to bind to the same socket twice; it's ↵rubidium
quite pointless.
2009-04-08(svn r15979) -Codechange: tweak the debug/warning levels of some of the ↵rubidium
messages when binding
2009-04-08(svn r15976) -Codechange: make it a bit more clear for what (type of) ↵rubidium
address binding fails
2009-04-08(svn r15975) -Codechange: register each of the IPs we have bound to to the ↵rubidium
masterserver
2009-04-08(svn r15972) -Codechange: remove unneeded parameterrubidium
2009-04-07(svn r15970) -Codechange: make it possible to resolve a single address into ↵rubidium
multiple sockets.
2009-04-07(svn r15968) -Codechange: do not allocate a buffer for NetworkAddresses so ↵rubidium
passing it around is easier.
2009-04-04(svn r15951) -Fix (r15946) [FS#2803]: ofcourse a couple of OSes/compilers do ↵rubidium
not provide a nice 'interface', so we have to do it the ugly way.
2009-04-04(svn r15950) -Fix (r15946): mingw compilationglx
2009-04-04(svn r15946) -Codechange: move netmask matching to NetworkAddress and add ↵rubidium
some support for IPv6 netmask matching.
2009-04-03(svn r15944) -Codechange: disable IPv4 over IPv6 sockets as there is no ↵rubidium
default value and not all OSes actually support IPv4 over IPv6 so making it the same on all OSes eases debugging and such
2009-04-03(svn r15941) -Codechange: jonty-comp's wish partly implemented (content ↵rubidium
server) ;)
2009-04-03(svn r15940) -Codechange: move setting reuse address to the binding process.rubidium
2009-04-03(svn r15934) -Fix: work around Solaris' inability to "parse" 0 as defined in ↵rubidium
the specifications.
2009-04-03(svn r15933) -Fix (r15920): mingw doesn't know getaddrinfo() and ↵glx
freeaddrinfo() either
2009-04-03(svn r15925) -Codechange: remove _network_server_bind_ip as it's pretty AF ↵rubidium
dependant.