Commit Graph

67 Commits (75dd135e8d8aeb376d6bf8e2e3f71bb8fd88d4d8)

Author SHA1 Message Date
Jonathan G Rennison 75dd135e8d Merge tag '14.0-beta3' into jgrpp
# Conflicts:
#	regression/regression/result.txt
#	src/industrytype.h
#	src/network/core/config.h
#	src/network/core/network_game_info.cpp
#	src/network/core/network_game_info.h
#	src/network/core/packet.cpp
#	src/network/core/packet.h
#	src/network/core/tcp.cpp
#	src/network/core/tcp.h
#	src/network/core/tcp_admin.cpp
#	src/network/core/tcp_content.cpp
#	src/network/core/tcp_coordinator.cpp
#	src/network/core/tcp_game.cpp
#	src/network/core/tcp_game.h
#	src/network/core/tcp_turn.cpp
#	src/network/core/udp.cpp
#	src/network/core/udp.h
#	src/network/network_admin.cpp
#	src/network/network_client.cpp
#	src/network/network_client.h
#	src/network/network_command.cpp
#	src/network/network_content.cpp
#	src/network/network_internal.h
#	src/network/network_query.cpp
#	src/network/network_query.h
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/network/network_turn.cpp
#	src/network/network_udp.cpp
#	src/rail_gui.cpp
#	src/road_gui.cpp
3 months ago
Jonathan G Rennison 97e6f3062e Adding of _t to (u)int types, and WChar to char32_t
See: eaae0bb5e
5 months ago
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
10 months ago
Jonathan G Rennison d75c489466 Add various missing includes 11 months ago
Jonathan G Rennison d09b504bc5 Merge branch 'master' into jgrpp
# Conflicts:
#	.github/workflows/ci-build.yml
#	.github/workflows/release-linux.yml
#	.github/workflows/release-macos.yml
#	.github/workflows/release-source.yml
#	.github/workflows/release.yml
#	CMakeLists.txt
#	COMPILING.md
#	src/ai/ai_core.cpp
#	src/ai/ai_gui.cpp
#	src/bridge_gui.cpp
#	src/company_gui.cpp
#	src/console_cmds.cpp
#	src/core/CMakeLists.txt
#	src/core/smallmap_type.hpp
#	src/disaster_vehicle.h
#	src/effectvehicle_base.h
#	src/fontcache.cpp
#	src/game/game_core.cpp
#	src/game/game_gui.cpp
#	src/gamelog.cpp
#	src/gamelog_internal.h
#	src/group_gui.cpp
#	src/linkgraph/linkgraph.h
#	src/misc.cpp
#	src/network/core/config.h
#	src/network/core/udp.cpp
#	src/network/network_chat_gui.cpp
#	src/network/network_content_gui.cpp
#	src/network/network_gui.cpp
#	src/newgrf.cpp
#	src/newgrf_gui.cpp
#	src/newgrf_profiling.cpp
#	src/newgrf_profiling.h
#	src/object_gui.cpp
#	src/openttd.cpp
#	src/openttd.h
#	src/order_gui.cpp
#	src/os/windows/font_win32.cpp
#	src/rail_gui.cpp
#	src/road.cpp
#	src/road_gui.cpp
#	src/saveload/afterload.cpp
#	src/saveload/saveload.h
#	src/script/api/script_controller.cpp
#	src/script/api/script_roadtypelist.cpp
#	src/script/script_config.cpp
#	src/script/script_config.hpp
#	src/script/script_instance.cpp
#	src/script/script_scanner.cpp
#	src/script/squirrel.cpp
#	src/script/squirrel_helper.hpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/settings_type.h
#	src/table/settings/network_private_settings.ini
#	src/timetable_gui.cpp
#	src/vehicle.cpp
#	src/vehicle_base.h
#	src/window_gui.h
11 months ago
Peter Nelson c38df2d589 Codechange: Use std::map instead of custom SmallMap. 1 year ago
Peter Nelson 72018badff Codechange: Swap SocketList map key/value around.
This map is used store socket and address together, and, other than
checking that the address does not already have a socket, the data layout
does not seem particularly important.

However, as address is the key, technically it should not be modified,
and address may self-modify itself during comparisons.
1 year ago
Rubidium 68ff3fd062 Change: include fmt.h C++ headers in stdafx.h
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
1 year ago
Jonathan G Rennison f764fcfb1f Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/console_cmds.cpp
#	src/debug.cpp
#	src/lang/vietnamese.txt
#	src/network/core/address.cpp
#	src/network/core/address.h
#	src/network/core/config.h
#	src/network/core/os_abstraction.cpp
#	src/network/core/os_abstraction.h
#	src/network/core/tcp_listen.h
#	src/network/core/udp.cpp
#	src/network/core/udp.h
#	src/network/network.cpp
#	src/network/network_client.cpp
#	src/network/network_gamelist.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/newgrf.cpp
#	src/openttd.cpp
#	src/saveload/saveload.h
#	src/settings.cpp
#	src/settings_table.cpp
#	src/settings_type.h
#	src/table/settings/network_settings.ini
3 years ago
Jonathan G Rennison 0b0d154788 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	.github/workflows/ci-build.yml
#	src/lang/german.txt
#	src/lang/romanian.txt
#	src/lang/slovak.txt
#	src/lang/turkish.txt
#	src/network/core/address.cpp
#	src/network/core/tcp.h
#	src/network/core/udp.cpp
#	src/network/network.cpp
#	src/network/network_client.cpp
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/network/network_udp.cpp
#	src/openttd.cpp
#	src/saveload/newgrf_sl.cpp
#	src/tree_cmd.cpp
#	src/video/video_driver.hpp
#	src/window.cpp
#	src/window_gui.h
3 years ago
Jonathan G Rennison da1ac73c02 Merge commit 'f1dfa661a1898cde06a38ab4cb230c95912b245b' into jgrpp-beta
# Conflicts:
#	src/lang/estonian.txt
#	src/lang/hungarian.txt
#	src/network/core/game_info.cpp
#	src/network/core/game_info.h
#	src/network/core/packet.h
#	src/network/network.cpp
#	src/network/network_client.cpp
#	src/network/network_server.cpp
#	src/network/network_udp.cpp
#	src/openttd.cpp
#	src/string_func.h
3 years ago
Jonathan G Rennison 2bd535e834 Merge branch 'master' into jgrpp-beta
# Conflicts:
#	src/engine_base.h
#	src/gfxinit.cpp
#	src/graph_gui.cpp
#	src/lang/brazilian_portuguese.txt
#	src/lang/dutch.txt
#	src/lang/french.txt
#	src/lang/korean.txt
#	src/lang/norwegian_bokmal.txt
#	src/lang/portuguese.txt
#	src/lang/russian.txt
#	src/lang/spanish.txt
#	src/lang/spanish_MX.txt
#	src/network/core/address.cpp
#	src/network/core/game_info.h
#	src/network/core/os_abstraction.h
#	src/network/core/udp.cpp
#	src/network/network_client.cpp
#	src/network/network_client.h
#	src/network/network_internal.h
#	src/newgrf_engine.cpp
#	src/settings_gui.cpp
#	src/station_cmd.cpp
#	src/string_func.h
#	src/town_gui.cpp
#	src/video/video_driver.cpp
#	src/widget_type.h
3 years ago
Patric Stout 8adade26ed Feature: allow the use of STUN to connect client and server together
This method doesn't require port-forwarding to be used, and works for
most common NAT routers in home setups. But, for sure it doesn't work
for all setups, and not everyone will be able to use this.
3 years ago
Patric Stout 1baec41542 Change: groundwork to allow ServerAddress to use invite codes
Normally TCPConnecter will do a DNS resolving of the connection_string
and connect to it. But for SERVER_ADDRESS_INVITE_CODE this is different:
the Game Coordinator does the "resolving".

This means we need to allow TCPConnecter to not setup a connection
and allow it to be told when a connection has been setup by an external
(to TCPConnecter) part of the code. We do this by telling the (active)
socket for the connection.

This means the rest of the code doesn't need to know the TCPConnecter
is not doing a simple resolve+connect. The rest of the code only
cares the connection is established; not how it was established.
3 years ago
Patric Stout cee8174d02 Codechange: track servers with a ServerAddress instead of a NetworkAddress
This allows future extensions to have different ways of referencing
a server, instead of forcing to use IP:port.
3 years ago
rubidium42 667301e3ec Codechange: [Network] Make hostname/client IP return strings instead of a C-string 3 years ago
rubidium42 a91e29b656 Codechange: [Network] Let IsInNetmask use std::string 3 years ago
rubidium42 36705f1dc0 Codechange: [Network] Simplify formatting of network addresses to string 3 years ago
Patric Stout f7e390bdc0
Feature: use Happy Eyeballs to make network connections (TCP-only) (#9199)
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.
3 years ago
rubidium42 6c4a65eeb8 Codechange: [Network] Use std::string for NetworkAddress' host name 3 years ago
TechGeekNZ cf8ea74733 Update: Merge branch 'jgrpp_master_cmake' into jgrpp_cmake 4 years ago
Jonathan G Rennison 1ac0d4a5b2 Fix: Thread unsafe use of NetworkAddress::GetAddressAsString
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.
4 years ago
Jonathan G Rennison ef7e658dee Network: Remove static buffer form of NetworkAddress::GetAddressAsString
This is used in multiple threads concurrently
4 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
Charles Pigott 71a3e83468 Fix: GCC9's warnings about deprecated implicit assignment operators 5 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 5 years ago
Michael Lutz e804173595 Codechange: If something is a vector of strings, use a vector of strings instead of an AutoFreeSmallVector. 5 years ago
Henry Wilson cc62f4163f Cleanup: Remove unused size template parameters from SmallMap and Auto[Free|Delete]SmallVector 5 years ago
Henry Wilson c01a2e2a81 Codechange: Removed SmallVector completely 5 years ago
Patric Stout e3c639a09f Remove: ENABLE_NETWORK switch
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.
5 years ago
rubidium 289133be14 (svn r22695) -Fix [FS#4697]: mark addresses that could not be resolved as 'do not resolve anymore' as well, instead of trying to resolve them each and every time the address is accessed 13 years ago
rubidium 99ec3a044a (svn r22403) -Document: some more network/core code 13 years ago
rubidium eb299736c1 (svn r21886) -Codechange: move documentation towards the code to make it more likely to be updated [n]. 14 years ago
alberth 7303f7d199 (svn r21595) -Codechange: Some header files had their name changed, update the ifndef/define/endif lines. 14 years ago
smatz 0ef33548c2 (svn r19614) -Codechange: "it's" => "its" where appropriate 14 years ago
rubidium 5ff6053326 (svn r17699) -Codechange: move #ifdef ENABLE_NETWORK till after the 'generic' includes so compilation without network support doesn't get broken as easily by changes in header files 15 years ago
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 15 years ago
rubidium 951b9e7615 (svn r16238) -Change: improve/clarify some network related debug "error" messages by adding more information to them. Also give some clues on how to fix certain issues (like failing advertising). 15 years ago
rubidium 5db32d1dc5 (svn r16134) -Change: do not add duplicates to the broadcast list 15 years ago
rubidium d04ebf2fa5 (svn r16065) -Fix: don't readd (and resolve) the last joined server each time the window gets repainted 15 years ago
rubidium 47e2901e18 (svn r16034) -Fix: compile warnings generated by 64 bits MSVC. 15 years ago
rubidium 460fbc7c92 (svn r16007) -Fix (r16004): when we want to bind to both IPv4 and IPv6, make the master socket do that too; too bad getaddrinfo can't handle binding to any address on any port at the same time :( 15 years ago
rubidium c0f9af5607 (svn r16000) -Feature: IPv6 support 15 years ago
rubidium 882e495f5c (svn r15993) -Codechange: clean up/generalise the handling of the server list 15 years ago
rubidium 0f0cc67d62 (svn r15990) -Codechange: provide a thread safe variant of GetAddressAsString. 15 years ago
rubidium 9d6edae94d (svn r15981) -Fix: don't print the address family when writing the IP+port to the config file. 15 years ago
rubidium a5a424ce28 (svn r15978) -Codechange: support parsing [] enclosed IPv6 addresses. 15 years ago
rubidium 1eb4aa971e (svn r15975) -Codechange: register each of the IPs we have bound to to the masterserver 15 years ago
rubidium c0f8214218 (svn r15972) -Codechange: remove unneeded parameter 15 years ago
rubidium 6db7f15b3a (svn r15970) -Codechange: make it possible to resolve a single address into multiple sockets. 15 years ago