offset meters when resuming
This commit is contained in:
parent
5ff85c8515
commit
b55399e3ac
2 changed files with 6 additions and 5 deletions
|
@ -379,22 +379,24 @@ serveAuthed myuuid = void $ serverLoop handler
|
|||
handler _ = return ServerUnexpected
|
||||
|
||||
sendContent :: Key -> AssociatedFile -> Offset -> MeterUpdate -> Proto Bool
|
||||
sendContent key af offset p = do
|
||||
sendContent key af offset@(Offset n) p = do
|
||||
let p' = offsetMeterUpdate p (toBytesProcessed n)
|
||||
(len, content) <- readContentLen key af offset
|
||||
net $ sendMessage (DATA len)
|
||||
net $ sendBytes len content p
|
||||
net $ sendBytes len content p'
|
||||
checkSuccess
|
||||
|
||||
receiveContent :: MeterUpdate -> Local Len -> (Offset -> Len -> L.ByteString -> Local Bool) -> (Offset -> Message) -> Proto Bool
|
||||
receiveContent p sizer storer mkmsg = do
|
||||
Len n <- local sizer
|
||||
let p' = offsetMeterUpdate p (toBytesProcessed n)
|
||||
let offset = Offset n
|
||||
net $ sendMessage (mkmsg offset)
|
||||
r <- net receiveMessage
|
||||
case r of
|
||||
DATA len -> do
|
||||
ok <- local . storer offset len
|
||||
=<< net (receiveBytes len p)
|
||||
=<< net (receiveBytes len p')
|
||||
sendSuccess ok
|
||||
return ok
|
||||
_ -> do
|
||||
|
|
|
@ -7,8 +7,7 @@ Current todo list:
|
|||
* copy --to peer seems to make the remotedaemon buffer the content in
|
||||
memory, more than I'd expect.
|
||||
* update progress logs in remotedaemon send/receive
|
||||
* Resuming an interrupted download does not jump the progress to reflect
|
||||
the amount already present. And, it fails at the end.
|
||||
* Resuming an interrupted download fails at the end.
|
||||
* Think about locking some more. What happens if the connection to the peer
|
||||
is dropped while we think we're locking content there from being dropped?
|
||||
* merge to master
|
||||
|
|
Loading…
Add table
Reference in a new issue