haskell - Haskell SendFile 零拷贝 - 中止传输
问题描述
您好我想在 Haskell 中使用以下库在节点之间传输文件:https ://hackage.haskell.org/package/sendfile-0.7.11.1/docs/Network-Socket-SendFile.html
sendFile
如果文件已被另一个节点传输,我希望能够中止......
我正在考虑使用 iteratee 来做这个例子:
runIter :: IO Iter -> IO ()
runIter iter =
do r <- iter
case r of
(Done _n) -> return ()
(Sent _n cont) -> runIter cont
(WouldBlock _n fd cont) ->
do threadWaitWrite fd
runIter cont
我的问题是:我怎样才能中止这个转移?
我正在考虑做这样的事情:
(Sent _n cont) -> return ()
或者
(Sent _n cont) -> error "Already downloaded (Abort)"
基本上有办法让客户知道呼叫已中止......
库中没有任何解释来实现这种行为......
解决方案
推荐阅读
- c++ - Visual Studio Code C++ 调试器不启动
- c++ - arduino 的 C++ 是否遵循标准?
- python - 从多个工作表 Excel 文件中检索到的 Dict 中删除一列
- python - How can I open a window if my given conditions are true?
- mysql - 如何对两个 SUMmed SQL 结果字段求和
- flutter - 颤振容器消失
- angular - Ag 网格向列标题中的过滤器添加第二个 OR 或 AND
- javascript - 是否使用 Js 删除运算符从被认为是不好的做法的对象中删除属性?
- java - 从多个 Entity 对象创建 EntityIterable
- javascript - 为什么我的功能组件没有重新渲染?