UploadEventListener - reset bytesTransfered for each file (#145)
This commit is contained in:
parent
f40fe46d84
commit
ec221d9f05
2 changed files with 16 additions and 15 deletions
|
@ -15,18 +15,20 @@ object UploadEventListener {
|
||||||
totalBytesSoFar: Long
|
totalBytesSoFar: Long
|
||||||
)
|
)
|
||||||
|
|
||||||
var bytesTransferred = 0L
|
def apply(settings: Settings): UploadEvent => Unit =
|
||||||
|
uploadEvent => {
|
||||||
def listener(settings: Settings): UploadEvent => Unit = {
|
var bytesTransferred = 0L
|
||||||
case e: RequestEvent =>
|
uploadEvent match {
|
||||||
bytesTransferred += e.transferred
|
case e: RequestEvent =>
|
||||||
logRequestCycle(
|
bytesTransferred += e.transferred
|
||||||
RequestCycle(settings.localFile,
|
logRequestCycle(
|
||||||
bytesTransferred,
|
RequestCycle(settings.localFile,
|
||||||
settings.index,
|
bytesTransferred,
|
||||||
settings.syncTotals,
|
settings.index,
|
||||||
settings.totalBytesSoFar))
|
settings.syncTotals,
|
||||||
case _ => ()
|
settings.totalBytesSoFar))
|
||||||
}
|
case _ => ()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,7 @@ trait Uploader {
|
||||||
listenerSettings =>
|
listenerSettings =>
|
||||||
new ProgressListener {
|
new ProgressListener {
|
||||||
override def progressChanged(progressEvent: ProgressEvent): Unit =
|
override def progressChanged(progressEvent: ProgressEvent): Unit =
|
||||||
UploadEventListener.listener(listenerSettings)(
|
UploadEventListener(listenerSettings)(eventHandler(progressEvent))
|
||||||
eventHandler(progressEvent))
|
|
||||||
|
|
||||||
private def eventHandler: ProgressEvent => UploadEvent =
|
private def eventHandler: ProgressEvent => UploadEvent =
|
||||||
progressEvent => {
|
progressEvent => {
|
||||||
|
|
Loading…
Reference in a new issue