Commit Graph

207 Commits

Author SHA1 Message Date
themode 62a7346f40 cacheBuffer does not need to be volatile 2022-02-20 13:15:46 +01:00
themode a15156aeb4 Add EncryptionContext 2022-02-20 12:58:09 +01:00
TheMode 9b04e89552
Add PlayerPacketOutEvent (#689) 2022-02-17 13:51:55 +01:00
TheMode 87d5a33c76
Fix corruption when receiving multiple compressed packets (#611)
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-29 10:18:23 +01:00
themode 0b4dd3b8aa Heavily reduce the number of direct buffers required for each worker 2022-01-26 06:37:46 +01:00
TheMode d0b874ed7c Move local buffers
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-26 05:01:43 +01:00
themode 39a0923326 Add LazyPacket 2022-01-10 16:51:21 +01:00
themode 7df51ef606 Simplify CachedPacket 2022-01-10 16:51:21 +01:00
themode bb1b1e53d7 Improve performance when cached packets are disabled 2022-01-10 16:51:21 +01:00
TheMode 5b4ffa0846 Add SendablePacket#extractServerPacket
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode 076b11b77a Separate concern for packet reading
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode 02de469cad Use relaxedOffer, copy packet list to prevent modifications
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-21 14:34:24 +01:00
TheMode 767c743e01 Batch `sendPackets` list content in a single message
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-17 23:12:54 +01:00
TheMode 785bcb8b6d Fast exit if tick buffer can be reused
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-17 09:20:36 +01:00
TheMode 8b1856d5b7
Async packet write (#533) 2021-11-17 06:31:24 +01:00
TheMode c5e947c76e Move CachedPacket and FramedPacket
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-17 00:48:43 +01:00
TheMode ae08ac2987 Do not flush if channel is closed
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-08 09:11:02 +01:00
TheMode acc711c640
Revert "Volatile encryption (#515)" (#516)
This reverts commit 0f15d4a273.
2021-11-03 09:17:23 +01:00
TheMode 0f15d4a273
Volatile encryption (#515) 2021-11-03 09:06:06 +01:00
TheMode 970d4d2d9c Allow buffer index/length to be specified
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-02 03:08:36 +01:00
TheMode f86d91f9b8 Fix online mode
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-26 00:44:16 +02:00
TheMode 23d59cb135 Returned framed buffers should be flipped
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-26 00:05:03 +02:00
TheMode 00401bed25 Avoid allocation when writing framed packets
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-25 23:55:20 +02:00
TheMode 1851ea7eca Move OOM try-catch
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-25 10:08:25 +02:00
TheMode 06189ee783
Async flush (#492) 2021-10-16 19:55:24 +02:00
TheMode bd4aa90753
Framed packet cleanup (#489) 2021-10-13 06:33:44 +02:00
TheMode 11806b9166 Ensure no packet corruption due to encryption. A proxy is still recommended for optimal performance
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-06 21:14:08 +02:00
TheMode 2f1e4101d1 Add more try-catch to prevent the worker from returning
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-06 18:47:40 +02:00
TheMode 36bcf69728 Buffer collection cleaner
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-29 18:31:28 +02:00
TheMode 236683c986 No volatile read for compression/encryption
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-26 17:02:05 +02:00
TheMode 68107c9a90 Reuse the tick buffer when possible & avoid iteration
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-22 23:24:22 +02:00
TheMode 17807f35da Add experimental PlayerConnection#sendFramedPacket
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 18:59:15 +02:00
TheMode 380f5a5a67 Remove faulty fast exit
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 19:50:57 +02:00
TheMode 4b5ec566bd Allow FramedPackets to be sent safely
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 19:37:30 +02:00
TheMode 2ecd10a4ec Cipher#update is copy-safe
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 03:47:48 +02:00
TheMode 983850171b Use cleaner to reuse connection buffers
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-14 02:22:58 +02:00
TheMode e1a3c295a2 Add dedicated PooledBuffers class
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-13 22:12:07 +02:00
TheMode ee95015ed3 Simplify packet reading
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-11 03:39:59 +02:00
TheMode fd027ecfd7 Do not forget to put the buffer back in the pool queue
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-09 23:18:14 +02:00
TheMode 526108b896 Remove unnecessary allocation during encryption
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-09 23:15:57 +02:00
TheMode 8f1e84ffdb Prevent framed packets from being corrupted
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-07 01:24:51 +02:00
TheMode 72987ac52f Save the server from crashing from OOM due to the client or server not being able to handle the network load
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-06 16:17:30 +02:00
TheMode 7b8277b6be Do not flip the buffer inside #write(ByteBuffer)
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-04 23:56:27 +02:00
TheMode 885be567fa Avoid slice allocation
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-04 19:50:09 +02:00
TheMode d21414c146 Handle prepared buffer being bigger than the pooled ones
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-04 19:30:18 +02:00
TheMode 4f382c5684 Fix tick allocation
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-04 03:03:06 +02:00
TheMode df92939ddd Use soft references for pooled buffers
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-04 02:20:03 +02:00
TheMode 3d5ae6fe94 Pool main connection buffer
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-03 13:54:38 +02:00
TheMode 399eb860a7 Improve performance when slow clients are connected
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-02 15:44:36 +02:00
TheMode dbf5ff6cd4 Add `PlayerConnection#flush` without guarantee 2021-08-17 23:23:41 +02:00