-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make cross-platform #88
Comments
I presume something resembling |
That could be a future optimization for sure, but I think for now something simpler is enough. Besides, that solution would not fix incompatibility with mac/darwin/bsd, so someting more generic that is easy to maintain is better for now. |
Actually, |
There's really no need to make cratetorrent Linux-only. The only places that rely on platform specific APIs are:
/tmp
in tests an examples.The real issue is the first two. The solution is very simple: feature gate those methods of
TorrentFile
behind a Linux flag, and fallback to coalescing buffers and issuing a single write call for other platforms.[update]: It may actually be better to create a fallback of the
Piece::write
method instead of the lower levelTorrentFile::write
method.This is because the current piece write method allocates a temporary buffer of iovecs, which is only needed for the
pwritev
syscall. However, if we're coalescing buffers and issuing a singlewrite
, we can skip the iovecs allocation step and save an allocation and other additional logic. A little more work for better performance.The text was updated successfully, but these errors were encountered: