Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Fix a bug which causes webchannel to close prematurely when HTTP stre…
Browse files Browse the repository at this point in the history
…am is aborted.

RELNOTES: n/a

PiperOrigin-RevId: 427648028
Change-Id: I27c0e4133301977f6fd3d8f8beeb24ecaca6d48a
  • Loading branch information
sampajano authored and copybara-github committed Feb 10, 2022
1 parent 6bde623 commit 3241766
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions closure/goog/labs/net/webchannel/webchannelbase.js
Original file line number Diff line number Diff line change
Expand Up @@ -2047,13 +2047,14 @@ WebChannelBase.prototype.clearDeadBackchannelTimer_ = function() {
* failed request.
* @param {?ChannelRequest.Error} error The error code for the
* failed request.
* @param {number} statusCode The last HTTP status code.
* @return {boolean} Whether or not the error is fatal.
* @private
*/
WebChannelBase.isFatalError_ = function(error) {
WebChannelBase.isFatalError_ = function(error, statusCode) {
'use strict';
return error == ChannelRequest.Error.UNKNOWN_SESSION_ID ||
error == ChannelRequest.Error.STATUS;
(error == ChannelRequest.Error.STATUS && statusCode > 0);
};


Expand Down Expand Up @@ -2101,7 +2102,7 @@ WebChannelBase.prototype.onRequestComplete = function(request) {
// Else unsuccessful. Fall through.

const lastError = request.getLastError();
if (!WebChannelBase.isFatalError_(lastError)) {
if (!WebChannelBase.isFatalError_(lastError, this.lastStatusCode_)) {
// Maybe retry.
const self = this;
this.channelDebug_.debug(function() {
Expand Down

0 comments on commit 3241766

Please sign in to comment.