mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Fix socket management for unlinkAndDisconnect
This commit is contained in:
@@ -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
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user