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