refactor http2 file (#864)

* refactor http2 file

* move fileBlockSize to HTTP2.File
This commit is contained in:
Evgeny Poberezkin
2023-10-19 10:25:21 +01:00
committed by GitHub
parent 5e047f3199
commit decf25d7dc
4 changed files with 48 additions and 30 deletions

View File

@@ -49,6 +49,7 @@ import Simplex.Messaging.Transport (supportedParameters)
import Simplex.Messaging.Transport.Client (TransportClientConfig, TransportHost)
import Simplex.Messaging.Transport.HTTP2
import Simplex.Messaging.Transport.HTTP2.Client
import Simplex.Messaging.Transport.HTTP2.File
import Simplex.Messaging.Util (bshow, liftEitherError, whenM)
import UnliftIO
import UnliftIO.Directory
@@ -153,7 +154,7 @@ sendXFTPCommand XFTPClient {config, http2Client = http2@HTTP2Client {sessionId}}
forM_ chunkSpec_ $ \XFTPChunkSpec {filePath, chunkOffset, chunkSize} ->
withFile filePath ReadMode $ \h -> do
hSeek h AbsoluteSeek $ fromIntegral chunkOffset
sendFile h send $ fromIntegral chunkSize
hSendFile h send $ fromIntegral chunkSize
done
createXFTPChunk ::