summaryrefslogtreecommitdiff
path: root/src/network
AgeCommit message (Collapse)Author
2021-04-24Codechange: remove public access to the next pointer in PacketRubidium
2021-04-24Codechange: encapsulate reading the size of a PacketRubidium
2021-04-24Codechange: encapsulate the logic about how many bytes can be sent from a ↵Rubidium
buffer in to a Packet
2021-04-24Codechange: move the logic shrinking of the packets into the Packet itselfRubidium
2021-04-24Codechange: encapsulate writing data from Packets into sockets/files/buffers ↵Rubidium
to prevent packet state modifications outside of the Packet
2021-04-24Codechange: encapsulate reading data from sockets into Packets to prevent ↵Rubidium
packet state modifications outside of the Packet
2021-04-24Codechange: move logic whether there is enough space in a packet to write ↵Rubidium
data into the Packet
2021-04-24Codechange: move more logic about packet size validity and reading into PacketRubidium
2021-04-24Add: [Network] Validate the client name when receiving one from the serverrubidium42
This so names from other clients are known valid in the client as well, instead allowing some compromised/bad server to potentially crash clients upon certain expectations.
2021-04-24Add: [Network] Validate the client name server side, so no clients with ↵rubidium42
invalid names can actually join
2021-04-24Change: [Network] Prevent invalid client names being sent to the server when ↵rubidium42
changing it using the console/settings
2021-04-24Feature: [Network] Ensure players fill in a name instead of defaulting to ↵rubidium42
"Player"
2021-04-24Codechange: [Network] Introduce function to validate the client namerubidium42
2021-04-22Codechange: Use new widget features on chat message box.Peter Nelson
2021-04-21Codechange: merge duplicated logic to scroll in lists by key into a single ↵Rubidium
function
2021-04-20Doc: server name doesn't need to be advertised to be validPatric Stout
Strictly seen the comment is true, as it says 'e.g.', but it is misleading. The server name is just that: the name of the server as configured. No need to mention advertising.
2021-04-20Codechange: remove always-empty "address" from NetworkContentSocketHandlerPatric Stout
When ever you saw this debug lines (which you never should), they showed an empty address. It is also not very useful to have, as it always points to a known server anyway.
2021-04-20Codechange: split ParseConnectionString into two functionsPatric Stout
One also looks for a company, the other doesn't. There were more uses of the latter than the first, leaving very weird code all over the place.
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-17Fix #9042: Make multiplayer server list height auto-fill window.Peter Nelson
#9042 did not fix all combinations of scaling options. This additional change makes the server list automatically fill available height.
2021-04-16Feature: Show previous chat history when the chat message box is openPeter Nelson
2021-04-16Codechange: Use std::deque for chat history instead of fixed arrayPeter Nelson
2021-04-16Fix: Sizing of Multiplayer server list incorrect when GUI zoom doesn't match ↵Peter Nelson
Font zoom. The server information panel was scaled by GUI scale, which could result in a panel that is longer than the server list. This height difference is then maintained when the window is resized to fill the screen. Instead, specify the minimum size by number of text lines and (summed total) padding.
2021-04-12Change: warn the user about the resolving of an address being extra very slowRubidium
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-04-07Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of ↵Niels Martin Hansen
static buffers
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-03-10Add: make modal windows update more smoothPatric Stout
Basically, modal windows had their own thread-locking for what drawing was possible. This is a bit nonsense now we have a game-thread. And it makes much more sense to do things like NewGRFScan and GenerateWorld in the game-thread, and not in a thread next to the game-thread. This commit changes that: it removes the threads for NewGRFScan and GenerateWorld, and just runs the code in the game-thread. On regular intervals it allows the draw-thread to do a tick, which gives a much smoother look and feel. It does slow down NewGRFScan and GenerateWorld ever so slightly as it spends more time on drawing. But the slowdown is not measureable on my machines (with 700+ NewGRFs / 4kx4k map and a Debug build). Running without a game-thread means NewGRFScan and GenerateWorld are now blocking.
2021-03-03Fix #8799: NGameAllowedSorter() is not imposing strict weak ordering ↵Patric Stout
relation (#8801) In other words, it should only (!) return true if A comes for B. This promise was broken for the situation where two values are identical. It would return true in these cases too. This is of course not possible: if two values are identical, neither come before the other. As such, the sorter was not imposing strict weak ordering relations. libstdc++ handled this scenario just fine, but libc++ crashes badly on this, as it allowed comparing of [begin, end] instead of [begin, end). libc++ considered this not a bug (and by specs, they are correct; just this way of crashing is of course a bit harsh): https://bugs.llvm.org/show_bug.cgi?id=47903
2021-02-28Fix #6266: Ugly lists in network lobby windows on double/quad interface ↵dP
sizes with custom fonts
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-02-20Codechange: rename sound ids to make more sense. (#8701)frosch
2021-02-08Fix: mention our websites with https:// (instead of http://) (#8657)Patric Stout
It is 2021. Nobody should advertise http anymore. Not even us.
2021-02-05Codechange: Apply coding style (#8640)SamuXarick
* Fix: Missing or needed spaces * Codechange: Remove space * Codechange: Remove space * Codechange: More missing spaces * Codechange: Missing spaces * Codechange: Remove space * Codechange: Remove space
2021-01-31Fix 2db88953: default Network Server List sorter put compatible servers in ↵Patric Stout
wrong order (#8626) If a server is compatible, it falls back to sorting by clients. This used to be in reverse, so full servers are on top. With the codechange commit, this was removed by accident, and as such empty servers were on top. This is silly.
2021-01-22Change: Apply some consistency to singleplayer related commentsglx22
2021-01-08Fix: Start the inactivity-timeout for the content server only after the ↵frosch
connection has been established. (#8530) When connecting took long due to the first N resolve-addresses timing out, OpenTTD would immediately close the connection, without sending anything.
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.
2021-01-02Fix: prevent clients making emergency saves twice if server disconnects (#8477)Patric Stout
This was clearly overlooked during the initial implementation.
2020-12-27Fix b408fe7: Don't try to construct a std::string from nullptrCharles Pigott
2020-12-27Codechange: Even more std::string usage in file IO.Michael Lutz
2020-12-27Codechange: Convert some more FIO functions to take std::string.Michael Lutz