diff options
author | Joey Sacchini <joey@sacchini.net> | 2021-01-07 13:52:33 -0500 |
---|---|---|
committer | Joey Sacchini <joey@sacchini.net> | 2021-01-07 13:52:33 -0500 |
commit | 3451193c972e0d6c8d145658d8b56fba1aa6cab5 (patch) | |
tree | 45158f888109e052659e632cab4021a2f86e166e /src/wrapper.rs | |
parent | 6ec44bd5b6a354c55f3f5175f55d26534ee5b886 (diff) | |
download | craftio-rs-3451193c972e0d6c8d145658d8b56fba1aa6cab5.tar.gz craftio-rs-3451193c972e0d6c8d145658d8b56fba1aa6cab5.tar.bz2 craftio-rs-3451193c972e0d6c8d145658d8b56fba1aa6cab5.zip |
add max packet size as a configurable option for any CraftIo
Diffstat (limited to 'src/wrapper.rs')
-rw-r--r-- | src/wrapper.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wrapper.rs b/src/wrapper.rs index 992988c..19ec840 100644 --- a/src/wrapper.rs +++ b/src/wrapper.rs @@ -47,4 +47,17 @@ pub trait CraftIo { /// error is returned and nothing in the underlying state is changed. /// fn enable_encryption(&mut self, key: &[u8], iv: &[u8]) -> Result<(), CipherError>; + + /// + /// Sets the max packet size which this I/O wrapper will decode or transmit. + /// + /// This limit is meant to be used to ensure connections never allocate gigantic buffers. + /// Therefore, the limitation applies to the representation of packet in memory. This means + /// that a reader cannot read a compressed packet above this threshold, nor can it decompress + /// to a packet which is above this threshold. A writer cannot write a packet which exceeds + /// this size (when serialized) even if compression is enabled. + /// + /// todo split the compressed vs not compressed limits? + /// + fn set_max_packet_size(&mut self, max_size: usize); } |