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,9 +15,10 @@ object UploadEventListener {
|
|||
totalBytesSoFar: Long
|
||||
)
|
||||
|
||||
def apply(settings: Settings): UploadEvent => Unit =
|
||||
uploadEvent => {
|
||||
var bytesTransferred = 0L
|
||||
|
||||
def listener(settings: Settings): UploadEvent => Unit = {
|
||||
uploadEvent match {
|
||||
case e: RequestEvent =>
|
||||
bytesTransferred += e.transferred
|
||||
logRequestCycle(
|
||||
|
@ -28,5 +29,6 @@ object UploadEventListener {
|
|||
settings.totalBytesSoFar))
|
||||
case _ => ()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -77,8 +77,7 @@ trait Uploader {
|
|||
listenerSettings =>
|
||||
new ProgressListener {
|
||||
override def progressChanged(progressEvent: ProgressEvent): Unit =
|
||||
UploadEventListener.listener(listenerSettings)(
|
||||
eventHandler(progressEvent))
|
||||
UploadEventListener(listenerSettings)(eventHandler(progressEvent))
|
||||
|
||||
private def eventHandler: ProgressEvent => UploadEvent =
|
||||
progressEvent => {
|
||||
|
|
Loading…
Reference in a new issue