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

Method closeSocket

lib/socket/socket.react.js:218–239  ·  view source on GitHub ↗
(
    // This param is a hack. When closing a socket there is a race between this
    // function and the one to propagate the activity update. We make sure that
    // the activity update wins the race by passing in this param.
    activityUpdatePending: boolean,
  )

Source from the content-addressed store, hash-verified

216 }
217
218 closeSocket(
219 // This param is a hack. When closing a socket there is a race between this
220 // function and the one to propagate the activity update. We make sure that
221 // the activity update wins the race by passing in this param.
222 activityUpdatePending: boolean,
223 ) {
224 const { status } = this.props.connection;
225 if (status === 'disconnected') {
226 return;
227 } else if (status === 'disconnecting' || status === 'forcedDisconnecting') {
228 this.reopenConnectionAfterClosing = false;
229 return;
230 }
231 this.stopPing();
232 this.props.dispatch({
233 type: updateConnectionStatusActionType,
234 payload: { status: 'disconnecting', keyserverID: this.props.keyserverID },
235 });
236 if (!activityUpdatePending) {
237 this.finishClosingSocket();
238 }
239 }
240
241 forceCloseSocket() {
242 this.stopPing();

Callers 2

componentWillUnmountMethod · 0.95
componentDidUpdateMethod · 0.95

Calls 2

stopPingMethod · 0.95
finishClosingSocketMethod · 0.95

Tested by

no test coverage detected