Skip to content

Commit

Permalink
fix: terminate devices fully
Browse files Browse the repository at this point in the history
  • Loading branch information
mint-dewit committed Aug 31, 2023
1 parent c11801a commit 028167a
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ export class AtemDevice extends DeviceWithState<DeviceState, DeviceOptionsAtemIn
.catch(() => {
resolve(false)
})
.finally(() => {
this._atem.destroy().catch(() => null)
this._atem.removeAllListeners()
})
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export class CasparCGDevice extends DeviceWithState<State, DeviceOptionsCasparCG
this._ccg.disconnect()
this._ccg.onDisconnected = () => {
resolve(true)
this._ccg.removeAllListeners()
}
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export class HTTPSendDevice extends DeviceWithState<HTTPSendState, DeviceOptions
}
async terminate() {
this._doOnTime.dispose()
this.activeLayers.clear()
return Promise.resolve(true)
}
getStatus(): DeviceStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ export class OSCMessageDevice extends DeviceWithState<OSCDeviceState, DeviceOpti
}
async terminate() {
this._doOnTime.dispose()
this._oscClient.close()
this._oscClient.removeAllListeners()
return Promise.resolve(true)
}
getStatus(): DeviceStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export class ShotokuDevice extends DeviceWithState<ShotokuDeviceState, DeviceOpt
}
async terminate() {
this._doOnTime.dispose()
await this._shotoku.dispose()
return Promise.resolve(true)
}
getStatus(): DeviceStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export class SisyfosMessageDevice extends DeviceWithState<SisyfosState, DeviceOp
async terminate() {
this._doOnTime.dispose()
this._sisyfos.dispose()
this._sisyfos.removeAllListeners()
return Promise.resolve(true)
}
getStatus(): DeviceStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export class VizMSEDevice extends DeviceWithState<VizMSEState, DeviceOptionsVizM
async terminate(): Promise<boolean> {
if (this._vizmseManager) {
await this._vizmseManager.terminate()
this._vizmseManager.removeAllListeners()
delete this._vizmseManager
}
this._doOnTime.dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export class VMixDevice extends DeviceWithState<VMixStateExtended, DeviceOptions
async terminate() {
this._doOnTime.dispose()
await this._vmix.dispose()
this._vmix.removeAllListeners()
return Promise.resolve(true)
}

Expand Down

0 comments on commit 028167a

Please sign in to comment.