File tree Expand file tree Collapse file tree 2 files changed +4
-20
lines changed
Expand file tree Collapse file tree 2 files changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414 launchAndroidHost ,
1515 setupAndroidHost
1616} from './frida-android-integration' ;
17+ import { combineParallelCalls } from '@httptoolkit/util' ;
1718
1819export class FridaAndroidInterceptor implements Interceptor {
1920
@@ -26,16 +27,7 @@ export class FridaAndroidInterceptor implements Interceptor {
2627 private config : HtkConfig
2728 ) { }
2829
29- private _fridaTargetsPromise : Promise < Array < FridaHost > > | undefined ;
30- async getFridaHosts ( ) : Promise < Array < FridaHost > > {
31- if ( ! this . _fridaTargetsPromise ) {
32- // We cache the targets lookup whilst it's active, so that concurrent calls
33- // all just run one lookup and return the same result.
34- this . _fridaTargetsPromise = getAndroidFridaHosts ( this . adbClient )
35- . finally ( ( ) => { this . _fridaTargetsPromise = undefined ; } ) ;
36- }
37- return await this . _fridaTargetsPromise ;
38- }
30+ getFridaHosts = combineParallelCalls ( ( ) => getAndroidFridaHosts ( this . adbClient ) ) ;
3931
4032 async isActivable ( ) : Promise < boolean > {
4133 return ( await this . getFridaHosts ( ) ) . length > 0 ;
Original file line number Diff line number Diff line change 11import _ from 'lodash' ;
22import { UsbmuxClient } from 'usbmux-client' ;
33import * as FridaJs from 'frida-js' ;
4+ import { combineParallelCalls } from '@httptoolkit/util' ;
45
56import { Interceptor } from ".." ;
67import { HtkConfig } from '../../config' ;
@@ -23,16 +24,7 @@ export class FridaIosInterceptor implements Interceptor {
2324 private config : HtkConfig
2425 ) { }
2526
26- private _fridaTargetsPromise : Promise < Array < FridaHost > > | undefined ;
27- async getFridaHosts ( ) : Promise < Array < FridaHost > > {
28- if ( ! this . _fridaTargetsPromise ) {
29- // We cache the targets lookup whilst it's active, so that concurrent calls
30- // all just run one lookup and return the same result.
31- this . _fridaTargetsPromise = getIosFridaHosts ( this . usbmuxClient )
32- . finally ( ( ) => { this . _fridaTargetsPromise = undefined ; } ) ;
33- }
34- return await this . _fridaTargetsPromise ;
35- }
27+ getFridaHosts = combineParallelCalls ( ( ) => getIosFridaHosts ( this . usbmuxClient ) ) ;
3628
3729 async isActivable ( ) : Promise < boolean > {
3830 return ( await this . getFridaHosts ( ) ) . length > 0 ;
You can’t perform that action at this time.
0 commit comments