0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-24 12:15:17 +00:00
Commit graph

44 commits

Author SHA1 Message Date
Robin C. Ladiges
497b5b44d6 fix: KeyNotFoundException
KeyNotFoundException: The given key 'time' was not present in the dictionary.
2024-04-27 17:11:13 -04:00
Robin C. Ladiges
082e480b1e crash ignored players
Otherwise they keep sending all their packets (including positional updates) to the server which costs bandwidth and processing power.
2024-04-27 15:14:38 -04:00
Robin C. Ladiges
dc20a9c831 small refactorings
- use brackets when possible
- set client.Id and client.Name earlier
- use client.Id instead of header.Id
- rename firstConn to isClientNew
2024-04-27 15:14:38 -04:00
Robin C. Ladiges
20ee74d0d6 fix: construct tag packet instead of caching it in memory
Because the tag packet received from the client could have an UpdateType that isn't both State and Time.
(Though currently the client always updates both together.)
2024-04-27 14:45:41 -04:00
Robin C. Ladiges
d6a8df448c
Refactoring ban command (#48)
* rename command: `ban ...` => `ban player ...`

To enable adding other subcommands starting with `ban`.

Moving ban list and crash related code into its own class to tidy the Program class up.

Change Id values of the crash cmds, to fit into the 16 byte max length imposed by ChangeStagePacket.IdSize.

* add command: `ban ip <ipv4-address>`

To add an IPv4 address to the ban list.

* add command: `ban profile <profile-id>`

To add a profile ID to the ban list.

* add command: `unban ip <ipv4-address>`

To remove a banned IPv4 address from the ban list.

* add command: `unban profile <profile-id>`

To remove a banned profile ID from the ban list.

* add commands: `ban enable` and `ban disable`

To set the value of `BanList.Enabled` to `true` or `false` without editing the `settings.json` file.

* add command: `ban list`

To show the current ban list settings.

* fix: actually working ban functionality

Changes:
- ignore new sockets from banned IP addresses way earlier.
- ignore all packets by banned profiles.

Intentionally keeping the connection open instead of d/c banned clients.
This is to prevent endless server logs due to automatically reconnecting clients.

Before:
Reconnecting clients aren't entering `ClientJoined` and therefore the d/c is only working on first connections.
Effectively banned clients got a d/c and then automatically reconnected again without getting a d/c again.
Therefore allowing them to play normally.

* use SortedSet instead of List for settings

To enforce unique entries and maintain a stable order inside of the `settings.json`.

* add commands: `ban stage <stage-name>` and `unban stage <stage-name>`

To kick players from the server when they enter a banned stage.

<stage-name> can also be a kingdom alias, which bans/unbans all stages in that kingdom.

Because we aren't banning the player, d/c them would be no good, because of the client auto reconnect.
Instead send them the crash and ignore all packets by them until they d/c on their own.

This is an alternative solution for issue #43.

* Update Server.cs

---------

Co-authored-by: Sanae <32604996+Sanae6@users.noreply.github.com>
2023-09-05 17:14:54 -06:00
Robin C. Ladiges
86c79177fd fix: synchronization issues
- Send empty `TagPacket` and `CapturePacket` on new connections, to reset old data back that other players might still have in their puppet from an
earlier connection.
- Cache and send `CostumePacket`, `CapturePacket`, `TagPacket`, `GamePacket` and `PlayerPacket` to (re-)connecting players.
- Clear Metadata cache for existing clients that connect fresh (after a game restart).
2023-09-05 16:51:58 -06:00
Robin C. Ladiges
69cef89953 fix: on reconnect do not disconnect the new client
Currently when a client connects that is already there,
the old socket is closed, and the code tries to reuse the existing client object by exchanging its socket.

Reusing the same client object and just changing its socket does cause issues though with copies of the client in other threads.
In the situations that I could reproduce, it always disconnected both sockets, the old one and then the new one.

Instead I make a copy of the client object, use the new socket, remove the old object and add the new object to the collection.

(cherry picked from commit 9e6c312c8e)
2022-10-10 11:12:28 -06:00
TheUbMunster
95c918b5c4 Removed fire-and-forget warnings, null-forgave some metadata. 2022-07-29 12:55:01 -06:00
Sanae
ab318db1b8 Clean up logging from testing 2022-04-27 21:32:52 -06:00
Sanae
605be3947f I'm going to commit war crimes 2022-04-27 14:17:02 -06:00
Sanae
df2e976782 balls 2022-04-27 14:09:50 -06:00
Sanae
a775e593c3 Absurd logging 2022-04-27 14:02:26 -06:00
Sanae
6288f8ae49 Put more logs around send 2022-04-27 13:43:03 -06:00
Sanae
4fb57f9b7e Suffer 2022-04-27 00:43:11 -06:00
Sanae
3cc35f52b8 logstreme 2022-04-27 00:31:48 -06:00
Sanae
bddce48f9d Stop using MemoryMarshal for header serde 2022-04-27 00:24:11 -06:00
Sanae
1bcb15eb54 Read header normally 2022-04-26 23:58:43 -06:00
Sanae
1f57a9fb65 puss 2022-04-26 23:54:05 -06:00
Sanae
5d1b95997c more logs 2 2022-04-26 23:53:03 -06:00
Sanae
497ebcc06b More logs 2022-04-26 23:48:13 -06:00
Sanae
cad2c5b9c8 u wot m8 2022-04-26 23:38:38 -06:00
Sanae
eaadb90ee3 Probably fix scenario merging for real this time 2022-04-26 22:40:02 -06:00
Sanae
aea7d4414f Revert potential scenario merging fix 2022-04-05 14:07:02 -06:00
Sanae
534a6c9655 Make packet transformation work in Send(Memory)
speedrun flag
2022-04-03 22:29:34 -06:00
Sanae
2a8e1696ab Remove another useless log 2022-03-15 15:02:27 -06:00
Sanae
3a8b38142e Lol 2022-03-15 01:31:24 -06:00
Sanae
09ff142a39 Also sync game packets 2022-03-15 01:23:37 -06:00
Sanae
8c5cd0ced2 Untested conversion to variable size packets 2022-03-10 23:59:02 -06:00
Sanae
134437eec9 Set client name regardless of connection type 2022-03-06 17:19:49 -06:00
Sanae
00626ab12f Add scenario merging and run reformatting on solution 2022-03-01 15:08:53 -06:00
Sanae
78af568603 Add RentZero extension as rented memory can be non-zero 2022-02-16 15:20:03 -06:00
Sanae
b173e53826 Clamp packet size on Send<T> 2022-02-16 15:07:00 -06:00
Sanae
18bd69338f Improve packet processing and send function 2022-02-16 14:33:21 -06:00
Sanae
514c68d2e9 Lycel go flippy flippy 2022-02-15 18:35:38 -06:00
Sanae
f0c3ae6963 Logs cleaned up, and tested shine support 2022-02-15 14:26:50 -06:00
Sanae
d60aa07e1f Implementing shine sync and other minor fixes 2022-02-14 13:45:58 -06:00
Sanae
d8e151712d Explicit null for CurrentCostume 2022-02-12 17:37:26 -06:00
Sanae
7bbba0c691 Everything just works™ 2022-02-10 22:25:47 -06:00
Sanae
8ac53f15f6 More logs 2022-02-10 02:42:35 -06:00
Sanae
6cae63ca38 Currently cleaning up transport related stuff 2022-02-09 22:29:10 -06:00
Sanae
7dbe2ecd55 Reformat solution 2022-02-09 19:44:50 -06:00
Sanae
6759f80bc5 Connected no longer depends on socket 2022-02-09 15:56:57 -06:00
Sanae
b660fcfd53 Good shit 2022-02-08 16:46:12 -06:00
Sanae
3f4a3fee9e Initial Commit 2021-11-28 22:32:29 -06:00