TalAloni / SMBLibrary

Free, Open Source, User-Mode SMB 1.0/CIFS, SMB 2.0, SMB 2.1 and SMB 3.0 server and client library
GNU Lesser General Public License v3.0
733 stars 185 forks source link

Making ClientMaxReadSize and ClientMaxWriteSize Configurable #230

Closed aliziyacevik closed 1 year ago

aliziyacevik commented 1 year ago

Currently, in our codebase, the maximum size for client read and write operations is defined by two static readonly variables, ClientMaxReadSize and ClientMaxWriteSize, both set to a value of 1048576 (1 megabyte). These variables are critical in defining the limits for read and write operations, ensuring that the client does not attempt to read or write excessively large blocks of data in a single operation.

Potential Benefits of Dynamism By hardcoding these values, we may limit the flexibility needed by various use cases that require larger or smaller data transaction limits. Making these variables dynamically configurable would allow users of the library to set limits based on their specific application requirements and operational environment.

Is there a specific reason behind setting the hardcoded value of 1048576 for both ClientMaxReadSizeand ClientMaxWriteSize? Was this value chosen based on certain benchmarks, testing, or inherent protocol limitations?

Would there be any potential risks or performance implications if we were to make these values configurable ? or is it even possible ?

TalAloni commented 1 year ago

Hi,

  1. Those values are set according to the SMB specifications and protocol limitations.
  2. Up to 16MB are negotiated if both the client and the server support Large MTU.