Adopt libsignal-net version with no auto-reconnect

Co-authored-by: Jordan Rose <jrose@signal.org>
This commit is contained in:
Sergey Skrobotov 2024-08-14 20:08:50 -07:00 committed by GitHub
parent 00e6071b1d
commit 30a419bb2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 139 additions and 71 deletions

View file

@ -591,14 +591,12 @@ export class SocketManager extends EventListener {
: TransportOption.Original;
}
private connectLibsignalUnauthenticated(): AbortableProcess<IWebSocketResource> {
return connectUnauthenticatedLibsignal({
libsignalNet: this.libsignalNet,
name: UNAUTHENTICATED_CHANNEL_NAME,
});
}
private async getUnauthenticatedResource(): Promise<IWebSocketResource> {
// awaiting on `this.getProxyAgent()` needs to happen here
// so that there are no calls to `await` between checking
// the value of `this.unauthenticated` and assigning it later in this function
const proxyAgent = await this.getProxyAgent();
if (this.unauthenticated) {
return this.unauthenticated.getResult();
}
@ -613,8 +611,6 @@ export class SocketManager extends EventListener {
log.info('SocketManager: connecting unauthenticated socket');
const proxyAgent = await this.getProxyAgent();
const transportOption = this.transportOption(proxyAgent);
log.info(
`SocketManager: connecting unauthenticated socket, transport option [${transportOption}]`
@ -623,7 +619,10 @@ export class SocketManager extends EventListener {
let process: AbortableProcess<IWebSocketResource>;
if (transportOption === TransportOption.Libsignal) {
process = this.connectLibsignalUnauthenticated();
process = connectUnauthenticatedLibsignal({
libsignalNet: this.libsignalNet,
name: UNAUTHENTICATED_CHANNEL_NAME,
});
} else {
process = this.connectResource({
name: UNAUTHENTICATED_CHANNEL_NAME,