(receivedResponseTo?: ?number)
| 254 | } |
| 255 | |
| 256 | finishClosingSocket(receivedResponseTo?: ?number) { |
| 257 | const { inflightRequests } = this.state; |
| 258 | if ( |
| 259 | inflightRequests && |
| 260 | !inflightRequests.allRequestsResolvedExcept(receivedResponseTo) |
| 261 | ) { |
| 262 | return; |
| 263 | } |
| 264 | if (this.socket && this.socket.readyState < 2) { |
| 265 | // If it's not closing already, close it |
| 266 | this.socket.close(); |
| 267 | } |
| 268 | this.socket = null; |
| 269 | this.stopPing(); |
| 270 | this.setState({ inflightRequests: null }); |
| 271 | if (this.props.connection.status !== 'disconnected') { |
| 272 | this.props.dispatch({ |
| 273 | type: updateConnectionStatusActionType, |
| 274 | payload: { |
| 275 | status: 'disconnected', |
| 276 | keyserverID: this.props.keyserverID, |
| 277 | }, |
| 278 | }); |
| 279 | } |
| 280 | if (this.reopenConnectionAfterClosing) { |
| 281 | this.reopenConnectionAfterClosing = false; |
| 282 | if (this.props.active) { |
| 283 | this.openSocket('connecting'); |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | reconnect: ReturnType<typeof _throttle> = _throttle( |
| 289 | () => this.openSocket('reconnecting'), |
no test coverage detected