MCPcopy Create free account
hub / github.com/CommE2E/comm / finishClosingSocket

Method finishClosingSocket

lib/socket/socket.react.js:256–286  ·  view source on GitHub ↗
(receivedResponseTo?: ?number)

Source from the content-addressed store, hash-verified

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'),

Callers 4

openSocketMethod · 0.95
closeSocketMethod · 0.95
forceCloseSocketMethod · 0.95
SocketClass · 0.95

Calls 4

stopPingMethod · 0.95
openSocketMethod · 0.95
closeMethod · 0.65

Tested by

no test coverage detected