Fix socket management for unlinkAndDisconnect
This commit is contained in:
parent
039bd072ed
commit
5780c3d4b8
5 changed files with 55 additions and 24 deletions
|
@ -187,14 +187,18 @@ export class SocketManager extends EventListener {
|
|||
authenticated = await process.getResult();
|
||||
this.status = SocketStatus.OPEN;
|
||||
} catch (error) {
|
||||
strictAssert(this.authenticated === process, 'Someone stole our socket');
|
||||
this.dropAuthenticated(process);
|
||||
|
||||
window.log.warn(
|
||||
'SocketManager: authenticated socket connection failed with ' +
|
||||
`error: ${Errors.toLogFormat(error)}`
|
||||
);
|
||||
|
||||
// The socket was deliberately closed, don't follow up
|
||||
if (this.authenticated !== process) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.dropAuthenticated(process);
|
||||
|
||||
if (error instanceof HTTPError) {
|
||||
const { code } = error;
|
||||
|
||||
|
@ -389,6 +393,16 @@ export class SocketManager extends EventListener {
|
|||
}
|
||||
}
|
||||
|
||||
public async logout(): Promise<void> {
|
||||
const { authenticated } = this;
|
||||
if (authenticated) {
|
||||
authenticated.abort();
|
||||
this.dropAuthenticated(authenticated);
|
||||
}
|
||||
|
||||
this.credentials = undefined;
|
||||
}
|
||||
|
||||
//
|
||||
// Private
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue