[haiku-commits] Change in haiku[master]: FileRequest: More consistent progress reporting

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 25 Jul 2020 10:06:37 +0000

From leorize <leorize+oss@xxxxxxxxxxx>:

leorize has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3072 ;)


Change subject: FileRequest: More consistent progress reporting
......................................................................

FileRequest: More consistent progress reporting

Make BFileRequest reports download progress after every DataReceived()
calls.

DownloadProgress() format has also been changed to use 0 as
`bytesTotal` when the total size is unknown. This is similar to
BHttpRequest functions currently.

Change-Id: I2920ea00c4f841bb666425be6f8da418e913c727
---
M src/kits/network/libnetapi/FileRequest.cpp
1 file changed, 3 insertions(+), 3 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/72/3072/1

diff --git a/src/kits/network/libnetapi/FileRequest.cpp 
b/src/kits/network/libnetapi/FileRequest.cpp
index 82c5f35..02b0103 100644
--- a/src/kits/network/libnetapi/FileRequest.cpp
+++ b/src/kits/network/libnetapi/FileRequest.cpp
@@ -87,6 +87,7 @@
                                        fListener->DataReceived(this, chunk, 
transferredSize,
                                                chunkSize);
                                        transferredSize += chunkSize;
+                                       fListener->DownloadProgress(this, 
transferredSize, size);
                                } else
                                        break;
                        }
@@ -99,7 +100,6 @@
                                else
                                        return B_IO_ERROR;
                        }
-                       fListener->DownloadProgress(this, size, size);
                }

                return B_OK;
@@ -124,6 +124,7 @@

                // Add a parent directory entry.
                fListener->DataReceived(this, "+/,\t..\r\n", transferredSize, 
8);
+               fListener->DownloadProgress(this, transferredSize, 0);
                transferredSize += 8;
        }

@@ -161,12 +162,11 @@
                if (fListener != NULL) {
                        fListener->DataReceived(this, eplf.String(), 
transferredSize,
                                eplf.Length());
+                       fListener->DownloadProgress(this, transferredSize, 0);
                }
                transferredSize += eplf.Length();
        }
 
-       if (fListener != NULL)
-               fListener->DownloadProgress(this, transferredSize, 
transferredSize);
        if (!fQuit)
                fResult.SetLength(transferredSize);


--
To view, visit https://review.haiku-os.org/c/haiku/+/3072
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I2920ea00c4f841bb666425be6f8da418e913c727
Gerrit-Change-Number: 3072
Gerrit-PatchSet: 1
Gerrit-Owner: leorize <leorize+oss@xxxxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: FileRequest: More consistent progress reporting - Gerrit