Skip to content

Commit

Permalink
Fix exception on network retry.
Browse files Browse the repository at this point in the history
The numBytesRemainingObj parameter in |NetworkingEngine.send_| was
optional, but in some circumstances we were assuming that it was set.
This just changes the parameter to be non-optional.
In fact, the parameter now being non-optional revealed an error that
caused the numBytesRemainingObj to be lost on network retry.

Fixes #1930

Change-Id: I74f24309f859f975f51e20455739b806ed3f4ecd
  • Loading branch information
theodab committed May 9, 2019
1 parent f225c04 commit 273698d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/net/networking_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ shaka.net.NetworkingEngine.prototype.makeRequestWithRetry_ =
* @param {!shaka.net.Backoff} backoff
* @param {number} index
* @param {?shaka.util.Error} lastError
* @param {shaka.net.NetworkingEngine.NumBytesRemainingClass=}
* @param {shaka.net.NetworkingEngine.NumBytesRemainingClass}
* numBytesRemainingObj
* @return {!shaka.extern.IAbortableOperation.<
* shaka.net.NetworkingEngine.ResponseAndGotProgress>}
Expand Down Expand Up @@ -547,7 +547,8 @@ shaka.net.NetworkingEngine.prototype.send_ = function(
// Move to the next URI.
index = (index + 1) % request.uris.length;
const shakaError = /** @type {shaka.util.Error} */(error);
return this.send_(type, request, backoff, index, shakaError);
return this.send_(type, request, backoff, index, shakaError,
numBytesRemainingObj);
}

// The error was not recoverable, so do not try again.
Expand Down

0 comments on commit 273698d

Please sign in to comment.