diff --git a/packages/backend/src/nest/storage/storage.service.ts b/packages/backend/src/nest/storage/storage.service.ts index 54d7a65b0a..8d55511d5f 100644 --- a/packages/backend/src/nest/storage/storage.service.ts +++ b/packages/backend/src/nest/storage/storage.service.ts @@ -506,15 +506,19 @@ export class StorageService extends EventEmitter { const community = await this.localDbService.getCurrentCommunity() if (community) { + this.logger(`Emitting ${StorageEvents.MESSAGE_IDS_STORED} storage event because community exists in local DB`) this.emit(StorageEvents.MESSAGE_IDS_STORED, { ids, channelId: channelData.id, communityId: community.id, }) + } else { + this.logger(`No community found in local DB`) } }) db.events.on('ready', async () => { + this.logger('Local DB ready.') const ids = this.getAllEventLogEntries(db).map(msg => msg.id) const community = await this.localDbService.getCurrentCommunity() diff --git a/packages/backend/src/nest/tor/tor-control.service.ts b/packages/backend/src/nest/tor/tor-control.service.ts index 4cea2a2075..3d33448b61 100644 --- a/packages/backend/src/nest/tor/tor-control.service.ts +++ b/packages/backend/src/nest/tor/tor-control.service.ts @@ -65,7 +65,6 @@ export class TorControl { this.logger(`Connecting to Tor, host: ${this.torControlParams.host} port: ${this.torControlParams.port}`) await this._connect() this.logger('Tor connected') - this.serverIoProvider.io.emit(SocketActionTypes.TOR_INITIALIZED) return } catch (e) { this.logger(e) diff --git a/packages/backend/src/nest/websocketOverTor/index.ts b/packages/backend/src/nest/websocketOverTor/index.ts index 929ac78cb2..05d278f166 100644 --- a/packages/backend/src/nest/websocketOverTor/index.ts +++ b/packages/backend/src/nest/websocketOverTor/index.ts @@ -77,6 +77,7 @@ export class WebSockets extends EventEmitter { let maConn: MultiaddrConnection try { + log('Dialling - ', ma.nodeAddress()) socket = await this._connect(ma, { websocket: { ...this._websocketOpts, diff --git a/packages/desktop/src/renderer/sagas/socket/socket.saga.ts b/packages/desktop/src/renderer/sagas/socket/socket.saga.ts index 82d3f7736a..b5e91708be 100644 --- a/packages/desktop/src/renderer/sagas/socket/socket.saga.ts +++ b/packages/desktop/src/renderer/sagas/socket/socket.saga.ts @@ -65,10 +65,17 @@ function subscribeSocketLifecycle(socket?: Socket) { logger.info('websocket connected') emit(socketActions.setConnected()) }) - socket?.on('disconnect', () => { - logger.info('closing socket connection') - emit(socketActions.suspendConnection()) - }) + socket?.on( + 'disconnect', + async (reason: string, description?: Error | { description: string; context?: any } | undefined) => { + if (reason === 'transport error') { + logger.error(`Error occurred, closing connection with reason ${reason}`, description) + } else { + logger.info('closing socket connection', reason, description) + } + emit(socketActions.suspendConnection()) + } + ) return () => {} }) }