Commit Graph

49 Commits

Author SHA1 Message Date
Rubidium 1cf8799810 Feature: encrypt the connection between game server and client 2024-03-17 19:48:34 +01:00
Rubidium 5706801ea7 Feature: authenticate to the server without sending the password
Either using password-authentication key exchange or via authorized keys
2024-03-17 19:09:22 +01:00
Rubidium fe12d38024 Codechange: split initiating of joining and identification of the client 2024-03-16 13:35:41 +01:00
Rubidium 72a44b0df6 Codechange: use references for handling received TCP packets 2024-02-05 16:30:49 +01:00
Rubidium c77a45ed86 Codechange: use std::unique_ptr for receiving network packets 2024-02-05 16:30:49 +01:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Jonathan G Rennison 4f6d75f97d Fix #11016: Defer deletion of client and server game socket handlers
This fixes various use after free scenarios in error handling paths
2023-06-25 12:02:32 +01:00
Jonathan G Rennison 19ae88fb63 Fix: Error logging in game and admin server HandlePacket
Don't invent a packet type in the log message if we can't/don't
read a packet type at all.
Fix packet type not being logged when appropriate.
2023-06-25 12:02:32 +01:00
Rubidium 4e65ec1dc4 Codechange: do not declare functions in blocks 2023-01-29 20:28:45 +01:00
dP 31cf9e888b
Add: [Network] external chat messages for remote admins (#9563) 2021-09-19 23:09:06 +02:00
Patric Stout 1ef4d3cf19
Remove: COMPANY_INFO packets and related code (#9475) 2021-08-14 23:24:02 +02:00
Patric Stout 9cc706847c
Fix: crash when joining a server again after a TCP disconnect (#9453)
"my_client" wasn't always free'd when a game ended. "my_client"
keeps a reference inside the PT_NCLIENT pool. The rest of the
code assumes that when you are not in a game, it can freely
reset this pool.
In result: several ways to trigger a use-after-free.
2021-07-21 21:55:30 +02:00
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
Patric Stout b136e65cf9
Change: reworked the debug levels for network facility (#9251)
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-12 16:34:02 +02:00
Patric Stout 36e22f3a7b
Fix: [Network] clients leaving because of broken connections was not 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-11 12:26:16 +02:00
Patric Stout b3003dd163 Add: ability to retrieve game info from server over TCP 2021-04-27 20:18:53 +02:00
Patric Stout 53c28a8ec9 Codechange: [Network] replace _realtime_tick with std::chrono 2021-02-27 00:36:14 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
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.
2019-03-20 19:24:55 +01:00
Niels Martin Hansen 4fb76db42f Feature #986: Automatic save when losing connection to a network game 2018-06-23 15:22:31 +02:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
rubidium b3e93d6520 (svn r26057) -Fix: a number of possibly uninitialised variables 2013-11-23 13:12:19 +00:00
rubidium 2e54c8fdfa (svn r26056) -Fix: a number of possibly uninitialised variables 2013-11-22 21:50:43 +00:00
rubidium e6ae8cf420 (svn r25593) -Cleanup: remove a few stale #defines 2013-07-13 06:18:16 +00:00
rubidium 2bf0fc3c5c (svn r23476) -Codechange: use the error queue to replace switch mode error strings, again making it possible to return multiple errors 2011-12-10 15:16:58 +00:00
rubidium 2e572b98de (svn r22400) -Codechange: replace some defines in the tcp/game code so doxygen can create better documentation 2011-05-01 11:30:03 +00:00
rubidium 97434f0e06 (svn r21392) -Change: prepare the network protocol for getting the file size later in the download process 2010-12-05 14:34:19 +00:00
rubidium b6c2216749 (svn r21358) -Codechange: make some network function names conform to coding style 2010-11-30 13:38:46 +00:00
rubidium 374fc308de (svn r21322) -Fix [FS#4268] (r20924): packets were leaked 2010-11-25 16:00:04 +00:00
rubidium 6d09f4a3cb (svn r21254) -Change: show a different "lag" message when a client is lagging because of connection trouble or lagging because the client is just slow 2010-11-19 12:33:19 +00:00
rubidium 2cd67a51ac (svn r21029) -Codechange: split the map downloading packet + 3-state enum into 3 separate packets 2010-10-24 20:03:33 +00:00
rubidium c9cbab14ea (svn r20937) -Codechange: move some variables from client/server to server only 2010-10-15 20:29:59 +00:00
rubidium 9858d699a3 (svn r20935) -Codechange: only let the server side use a pool of connected sockets 2010-10-15 19:58:56 +00:00
rubidium 7ba07d9573 (svn r20929) -Codechange: make NetworkCloseClient a class method 2010-10-15 18:42:52 +00:00
rubidium 0ca7e4e82e (svn r20924) -Codechange: make the game connection packet handling look more like UDP/content packet handling 2010-10-15 13:47:37 +00:00
rubidium 8eb07d097e (svn r20923) -Codechange: prepare creating sub-classes of NetworkClientSocket for server and client side 2010-10-15 13:22:00 +00:00
rubidium 926594b599 (svn r20547) -Change: the way order backups are performed. Now restoring an order doesn't require up to 765 commands. 2010-08-18 20:48:38 +00:00
rubidium 1c3d42598e (svn r20510) -Codechange: unify packet queue handling and make insertion O(1) instead of O(n) 2010-08-15 23:44:45 +00:00
rubidium ab35d95b5a (svn r19072) -Fix [FS#3599]: possible read/write after free when the client triggered the server to close the connection 2010-02-09 23:49:19 +00:00
rubidium f47f3a4157 (svn r19054) -Fix [FS#3598]: when banning yourself via rcon do not send the 'command response' to the client as the connection has already been terminated 2010-02-07 18:28:09 +00:00
rubidium 82fc28f77f (svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header 2010-01-15 16:41:15 +00:00
rubidium b00a5f1069 (svn r18330) -Cleanup: remove some unneeded includes 2009-11-28 20:35:25 +00:00
rubidium d6cded5380 (svn r17693) -Cleanup: remove some unneeded includes 2009-10-04 17:16:41 +00:00
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 2009-08-21 20:21:05 +00:00
rubidium 1fe3ad3288 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives 2009-08-05 17:59:21 +00:00
rubidium 9b156c1bd4 (svn r16601) -Fix [FS#2880]: try 2... hopefully better this time 2009-06-19 20:26:18 +00:00
smatz 62a7948af0 (svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved 2009-05-22 15:13:50 +00:00
rubidium e18c24cdb5 (svn r15079) -Codechange: split tcp 'backend' and in-game handling like it is for UDP. 2009-01-14 12:50:13 +00:00