Proper deferred stream state flip on connection break

This commit is contained in:
Muaz Ahmad 2023-08-21 18:43:35 +05:00
parent 880d010989
commit e026a83d06

View file

@ -39,6 +39,9 @@ func start(l net.Listener) {
func handle_conn(conn net.Conn, stream_live *bool) { func handle_conn(conn net.Conn, stream_live *bool) {
defer conn.Close() defer conn.Close()
defer func(a *bool) {
*a = false
}(stream_live)
if !DoHandshake(conn) { if !DoHandshake(conn) {
return return
} }
@ -54,5 +57,4 @@ func handle_conn(conn net.Conn, stream_live *bool) {
} }
HandleDataLoop(chunk_wrapper) HandleDataLoop(chunk_wrapper)
go StreamCleanup(chunk_wrapper.params.stream_key, 60) go StreamCleanup(chunk_wrapper.params.stream_key, 60)
*stream_live = false
} }