(
// 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,
)
| 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(); |
no test coverage detected