Skip to content

Commit

Permalink
fixup! feat(request-manager): support external Tor
Browse files Browse the repository at this point in the history
  • Loading branch information
karliatto committed Dec 10, 2024
1 parent b60c7e9 commit d5dea91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/request-manager/src/controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { EventEmitter } from 'events';
import path from 'path';

import { ScheduleActionParams, ScheduledAction, scheduleAction } from '@trezor/utils';
import { checkFileExists } from '@trezor/node-utils';

import { TorControlPort } from './torControlPort';
Expand All @@ -11,8 +12,6 @@ import {
TOR_CONTROLLER_STATUS,
} from './types';
import { bootstrapParser, BOOTSTRAP_EVENT_PROGRESS } from './events/bootstrap';
import { waitUntil } from './utils';
import { ScheduleActionParams, ScheduledAction, scheduleAction } from '@trezor/utils';

const WAITING_TIME = 1000;
const MAX_TRIES_WAITING = 200;
Expand Down
6 changes: 5 additions & 1 deletion packages/request-manager/src/controllerExternal.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EventEmitter } from 'events';

import { ScheduleActionParams, ScheduledAction, scheduleAction } from '@trezor/utils';
import { checkSocks5Proxy } from '@trezor/node-utils';

import { TOR_CONTROLLER_STATUS, TorControllerStatus, TorExternalConnectionOptions } from './types';
import { ScheduleActionParams, ScheduledAction, scheduleAction } from '@trezor/utils';

const WAITING_TIME = 1_000;
const MAX_TRIES_WAITING = 200;
Expand Down Expand Up @@ -55,8 +55,10 @@ export class TorControllerExternal extends EventEmitter {
const isRunning = await this.getIsExternalTorRunning();
if (isRunning) {
this.successfullyBootstrapped();

return true;
}

throw new Error('Tor external not alive');
};

Expand All @@ -68,8 +70,10 @@ export class TorControllerExternal extends EventEmitter {
attemptFailureHandler: () => {
if (this.getIsStopped()) {
abortController.abort();

return new Error('Operation stopped.');
}

return undefined;
},
};
Expand Down

0 comments on commit d5dea91

Please sign in to comment.