switch to BROKEN const delcration when error in data loop

This commit is contained in:
Muaz Ahmad 2023-09-23 20:45:07 +05:00
parent abe6337dc2
commit dbbec0954a

View file

@ -301,7 +301,7 @@ func (agent *SRTManager) process_data(packet *Packet) (*Packet) {
case SHUTDOWN: case SHUTDOWN:
// state 3 should raise error and shutdown tunnel, // state 3 should raise error and shutdown tunnel,
// for now start cleanup procedure in 10s // for now start cleanup procedure in 10s
agent.state = 3 agent.state = BROKEN
go CleanFiles(agent.stream_key, 10) go CleanFiles(agent.stream_key, 10)
default: default:
return nil return nil
@ -325,7 +325,7 @@ func (agent *SRTManager) handle_data_storage(packet *Packet) {
} }
// write out all possible packets // write out all possible packets
if err := agent.storage.Expunge(agent.output); err != nil { if err := agent.storage.Expunge(agent.output); err != nil {
agent.state = 4 agent.state = BROKEN
} }
} }