Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AFCore: Revert limit to 1MB; allocate buffers on-the-fly if exceeded
The limit to how large datagram can be seems to have no feasibly low limit (25MB datagrams have been reported to work). This imposes a challenge on caching/reuse strategies for direct byte buffers (a shared, reusable pool that is not thread-specific could be an alternative, but comes at the cost of complexity). At the cost of performance, revert the per-thread limit to 1MB, and return newly allocated direct byte buffers instead of cached ones whenever the limit is exceeded. Users of such unexpectedly large datagrams could either still force a higher (or unbounded) limit via the system property "org.newsclub.net.unix.thread-local-buffer.max-capacity", or better, use direct byte buffers in the calling code, obsoleting the need to use this cache in the first place. #118
- Loading branch information