summaryrefslogtreecommitdiff
path: root/src/network/network_server.cpp
AgeCommit message (Collapse)Author
2021-04-06Fix: [Network] State conditions for sending client info/quit packets (#8959)Jonathan G Rennison
Use status >= STATUS_AUTHORIZED as the state criteria for all cases where updates about other clients are sent. This avoids the case where a client is informed that another client has joined but not informed when it later quits, resulting in stale entries in the client list window.
2021-02-28Fix: [Network] don't show "server doesn't respond" while in queuePatric Stout
Send all clients in the queue every game-day a packet that they are still in the queue.
2021-02-28Fix: [Network] send map to next client if current client disconnectsPatric Stout
Also terminate creating of the savegame, as the client is gone, there really is no need for that anymore.
2021-02-28Fix: [Network] also count the person downloading the map in the queuePatric Stout
Strictly seen, there are "N" people -waiting- in front of you in the queue, but it is nicer to show "N + 1" for the person that is currently downloading the map. Avoids it showing: "0 clients in front of you". That just feels a bit off.
2021-02-27Change: Improve console warnings on invalid network commands (#8753)Pavel Stupnikov
2021-02-27Codechange: [Network] replace _realtime_tick with std::chronoPatric Stout
2021-02-27Fix bddfcaef: don't tell twice that a client left because of a timeout etc ↵Patric Stout
(#8746) SendError() notifies all clients of the disconnect. This calls CloseConnection() at the end, which also notified the clients of the disconnect. Really no need to do it twice. The status NETWORK_RECV_STATUS_SERVER_ERROR is only set by SendError(), so in case that is the status, don't let ClientConnection() send another notification.
2021-01-08Codechange: Remove min/max functions in favour of STL variants (#8502)Charles Pigott
2021-01-05Change: move "give money" from client-list to company windowPatric Stout
This is a much better location for this button, as you send money from one company to another company, not from player to player. This is based on work done by JGRPP in: https://github.com/JGRennison/OpenTTD-patches/commit/f82054339124cc6b89c5f4f9dac2d9da62f0108b and surrounding commits, which took the work from estys: https://www.tt-forums.net/viewtopic.php?p=1183311#p1183311 We did modify it to fix several bugs and clean up the code while here anyway. The callback was removed, as it meant a modified client could prevent anyone from seeing money was transfered. The message is now generated in the command itself, making that impossible.
2020-12-27Codechange: Replace assert_compile macro with static_assertCharles Pigott
2020-07-09Fix: Thread unsafe use of SendPacket for PACKET_SERVER_MAP_SIZEJonathan G Rennison
NetworkTCPSocketHandler::SendPacket is not thread safe and may not be used concurrently from multiple threads without suitable locking
2020-02-08Fix #7976: Don't kick the client doing the rconglx
2020-02-04Feature #7756: Allow server to supply a reason to kicked/banned clientsBjarni Thor
This commit adds the missing feature of allowing the server owner to provide a reason for kicking/banning a client, which the client sees in a pop-up window after being kicked. The implementation extends the network protocol by adding a new network action called NETWORK_ACTION_KICKED that is capable of having an error string, unlike the other network error packages. Additionally, the kick function broadcasts a message to all clients about the kicked client and the reason for the kick.
2020-01-12Feature: Auto-restart loads the original resources againBerbe
If the game was started loading a savegame or scenario, auto-restart will load a new random map. This is inconsistent with the case in which a heightmap was loaded, as in that case the heightmap is kept as a basis for a new game. This proposal solves this heterogeneity be considering the originally loaded resource shall be kept, hence savegames & scenarios shall be reloaded
2019-12-21Codechange: Replace vehicle related FOR_ALL with range-based for loopsglx
2019-12-21Codechange: Replace network related FOR_ALL with range-based for loopsglx
2019-12-21Codechange: Replace station related FOR_ALL with range-based for loopsglx
2019-12-21Codechange: Replace FOR_ALL_COMPANIES with range-based for loopsglx
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-09-29Fix: Some typos found using codespellJMcKiern
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-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-04-05Fix #7439: don't overwrite CompanyRemoveReason with ClientID (#7465)glx22
2019-03-26Codechange: Replaced SmallVector::[Begin|End]() with std alternativesHenry Wilson
2019-03-26Codechange: Replaced SmallVector::Append() with ↵Henry Wilson
std::vector::[push|emplace]_back()
2019-03-24Codechange: Use override specifer for overriding member declarationsHenry Wilson
This is a C++11 feature that allows the compiler to check that a virtual member declaration overrides a base-class member with the same signature. Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked as virtual despite being a template.
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-04Add: CompanyCtrlAction enum for CMD_COMPANY_CTRL actionsglx
2018-10-31Doc: Lots and lots of doxymentation fixesCharles Pigott
2018-04-30Fix: Some spelling errors in printed messagesMatthijs Kooijman
2017-08-13(svn r27893) -Codechange: Use fallthrough attribute. (LordAro)frosch
2014-10-07(svn r26975) -Fix: reading too many bits when determining the client index ↵rubidium
for desync debug message
2014-05-25(svn r26616) -Fix (r26576) [FS#6025]: First send packages about new company, ↵planetmaker
then clients joining it to admin port (Taede)
2014-05-11(svn r26576) -Fix [FS#6003]: [Network] AIs would not reset certain network ↵rubidium
state information upon creation of their company
2014-04-25(svn r26509) -Codechange: replace strdup with stredup (the latter ensures ↵rubidium
the return is not NULL)
2014-04-23(svn r26488) -Codechange: perform the appropriate length checks when getting ↵rubidium
a client name
2014-04-23(svn r26485) -Codechange: Replace ttd_strlcpy and ttd_strlcat with strecpy ↵frosch
and strecat.
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-21(svn r26043) -Fix [FS#5811]: occasional hanging when client joinsrubidium
2013-11-15(svn r26005) -Fix [FS#5478]: crash when transferring savegame from server to ↵rubidium
client
2013-01-08(svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by ↵planetmaker
Eagle_rainbow)
2012-10-09(svn r24580) -Fix [FS#5308]: Do not add duplicates to the ban list. (alechz)frosch
2012-05-09(svn r24221) -Fix [FS#5166]: Lag counters were not properly reset when ↵rubidium
switching states making it possible to get disconnected for lagging when you weren't lagging
2012-02-16(svn r23958) -Fix: don't allow chat messages from pre-active clients. As ↵rubidium
they haven't got the savegame yet, they won't have the interface to send them either (dihedral)
2012-02-16(svn r23957) -Fix [FS#4990]: allow sending chat to pre-active clients as the ↵rubidium
clients start accepting once they send 'map ok' to the server, which is the same moment we change their status to pre-active
2012-02-12(svn r23941) -Add: support for clangsmatz
2012-01-17(svn r23817) -Fix [FS#4962]: desync due to different NewGRF version. So ↵rubidium
reduce the chance that it happens significantly with betas/RCs/nightlies by doing the same as is done for stable releases: check the NewGRF version of server vs client. Previously this check was not done for nightlies/betas/RCs due to missing versioning information in the source tarballs, but they have that for a while now. So just force the NewGRF version check for all versions, and remove the broken --revision configure option
2012-01-09(svn r23780) -Fix [FS#4963] (r23764): also name the two new errors ↵truebrain
server-side. As extra, split up one of the errors in 3 errors, to be more specific what goes wrong. As cherry on top, make sure on all sides we can never again forget to add such entries on both sides, by introducing an assert_compile()
2012-01-07(svn r23769) -Codechange: make the lag/join start timeouts configurable as wellrubidium