Socket Close Error Fixed
This commit is contained in:
parent
9058519282
commit
5596f69114
@ -174,14 +174,19 @@ export class Stream {
|
|||||||
this.per_sec_bytes = 0
|
this.per_sec_bytes = 0
|
||||||
this.timer = null
|
this.timer = null
|
||||||
this.socket = null
|
this.socket = null
|
||||||
|
this.stream.on('close', () => {
|
||||||
|
this.cleanup()
|
||||||
|
})
|
||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
(duration > 300) ? this.loop_start() : this.normal_start()
|
(duration > 300) ? this.loop_start() : this.normal_start()
|
||||||
}
|
}
|
||||||
|
|
||||||
private cleanup(){
|
private cleanup(){
|
||||||
clearTimeout(this.timer as NodeJS.Timer)
|
clearTimeout(this.timer as NodeJS.Timer)
|
||||||
this.socket?.destroy()
|
this.socket?.end()
|
||||||
this.socket = null
|
this.socket?.on('close', () => {
|
||||||
|
console.log('Socket Closed')
|
||||||
|
})
|
||||||
this.timer = null
|
this.timer = null
|
||||||
this.url = ''
|
this.url = ''
|
||||||
this.bytes_count = 0
|
this.bytes_count = 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user