mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-20 11:57:51 +01:00
File Transfer: Add header to file transfer to indicate file size and transfer size. This is important to know when to stop reading. It will also help when reading only ranges (which is important for video streaming).
New function FileTransferReadHeaderUDT to read the header. Warehouse: ReadFile return count bytes read
This commit is contained in:
@@ -81,7 +81,7 @@ func apiWarehouseReadFile(w http.ResponseWriter, r *http.Request) {
|
||||
offset, _ := strconv.Atoi(r.Form.Get("offset"))
|
||||
limit, _ := strconv.Atoi(r.Form.Get("limit"))
|
||||
|
||||
status, err := core.UserWarehouse.ReadFile(hash, int64(offset), int64(limit), w)
|
||||
status, bytesRead, err := core.UserWarehouse.ReadFile(hash, int64(offset), int64(limit), w)
|
||||
|
||||
switch status {
|
||||
case warehouse.StatusFileNotFound:
|
||||
@@ -95,7 +95,7 @@ func apiWarehouseReadFile(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
core.Filters.LogError("warehouese.ReadFile", "status %d error: %v", status, err)
|
||||
core.Filters.LogError("warehouese.ReadFile", "status %d read %d error: %v", status, bytesRead, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user