Merge pull request #3298 from nextcloud/followup/3282/also-cancel-timeout-on-success

Also cancel the warning timeout on success or error
This commit is contained in:
Joas Schilling 2020-04-08 14:11:21 +02:00 коммит произвёл GitHub
Родитель 4f3d858f28 14677c10fb
Коммит 80e4b57368
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -82,6 +82,7 @@ function Base(settings) {
this.handlers = {}
this.features = {}
this._sendVideoIfAvailable = true
this.signalingConnectionTimeout = null
this.signalingConnectionWarning = null
this.signalingConnectionError = null
}
@ -550,7 +551,7 @@ Signaling.Standalone.prototype.reconnect = function() {
Signaling.Standalone.prototype.connect = function() {
if (this.signalingConnectionWarning === null) {
setTimeout(() => {
this.signalingConnectionTimeout = setTimeout(() => {
this.signalingConnectionWarning = showWarning(t('spreed', 'Establishing signaling connection is taking longer than expected …'), {
timeout: 0,
})
@ -567,6 +568,10 @@ Signaling.Standalone.prototype.connect = function() {
window.signalingSocket = this.socket
this.socket.onopen = function(event) {
console.debug('Connected', event)
if (this.signalingConnectionTimeout !== null) {
clearTimeout(this.signalingConnectionTimeout)
this.signalingConnectionTimeout = null
}
if (this.signalingConnectionWarning !== null) {
this.signalingConnectionWarning.hideToast()
this.signalingConnectionWarning = null
@ -580,6 +585,10 @@ Signaling.Standalone.prototype.connect = function() {
}.bind(this)
this.socket.onerror = function(event) {
console.error('Error', event)
if (this.signalingConnectionTimeout !== null) {
clearTimeout(this.signalingConnectionTimeout)
this.signalingConnectionTimeout = null
}
if (this.signalingConnectionWarning !== null) {
this.signalingConnectionWarning.hideToast()
this.signalingConnectionWarning = null
@ -593,6 +602,10 @@ Signaling.Standalone.prototype.connect = function() {
}.bind(this)
this.socket.onclose = function(event) {
console.debug('Close', event)
if (this.signalingConnectionTimeout !== null) {
clearTimeout(this.signalingConnectionTimeout)
this.signalingConnectionTimeout = null
}
if (this.signalingConnectionWarning !== null) {
this.signalingConnectionWarning.hideToast()
this.signalingConnectionWarning = null