Skip to content

Commit

Permalink
Fix abort when waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
Polina Gurina committed Mar 15, 2024
1 parent f12e104 commit 5d70f9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/electron/electron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { IMeasurementServerResponse } from "../measurement/interfaces/measuremen
import { LoopService } from "../measurement/services/loop.service"
import { ILoopModeInfo } from "../measurement/interfaces/measurement-registration-request.interface"
import { ERoutes } from "../ui/src/app/enums/routes.enum"
import { IPInfo } from "../measurement/interfaces/ip-info.interface"
import { WindowManager } from "./lib/window-manager"
import { getEnv } from "./lib/get-env"
import { IUserSettings } from "../measurement/interfaces/user-settings-response.interface"
Expand Down Expand Up @@ -135,9 +134,12 @@ ipcMain.on(Events.RUN_MEASUREMENT, (event, loopModeInfo) =>
MeasurementRunner.I.onRunMeasurement(event, loopModeInfo)
)

ipcMain.on(Events.ABORT_MEASUREMENT, () => {
ipcMain.on(Events.ABORT_MEASUREMENT, (event) => {
LoopService.I.resetTimeout()
MeasurementRunner.I.abortMeasurement()
const isRunning = MeasurementRunner.I.abortMeasurement()
if (!isRunning) {
event.sender.send(Events.MEASUREMENT_ABORTED)
}
})

ipcMain.on(
Expand Down
6 changes: 3 additions & 3 deletions src/measurement/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ export class MeasurementRunner {
}

abortMeasurement() {
if (this.rmbtClient) {
if (this.rmbtClient?.isRunning) {
this.rmbtClient.abortMeasurement()
return !this.rmbtClient.isRunning
return this.rmbtClient.isRunning
}
return true
return false
}

getCurrentPhaseState(): IMeasurementPhaseState & IBasicNetworkInfo {
Expand Down

0 comments on commit 5d70f9b

Please sign in to comment.