Properly disconnect clients
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
bf54e459b6
commit
b1a290e7d0
3
mount.go
3
mount.go
|
@ -220,7 +220,6 @@ func (m *StreamMount) Process(group *sync.WaitGroup) {
|
|||
}
|
||||
if l.Write(packet) != nil {
|
||||
toRemove = append(toRemove, i)
|
||||
l.Close()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,7 +227,9 @@ func (m *StreamMount) Process(group *sync.WaitGroup) {
|
|||
m.listenersLock.Lock()
|
||||
//TODO: remove more than one per iteration
|
||||
for _, i := range toRemove {
|
||||
l := m.listeners[i]
|
||||
m.listeners = append(m.listeners[:i], m.listeners[i+1:]...)
|
||||
l.Close()
|
||||
break
|
||||
}
|
||||
m.listenersLock.Unlock()
|
||||
|
|
6
queue.go
6
queue.go
|
@ -8,6 +8,7 @@ import (
|
|||
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format/opus"
|
||||
"git.gammaspectra.live/S.O.N.G/Kirika/audio/format/tta"
|
||||
"git.gammaspectra.live/S.O.N.G/Kirika/audio/packetizer"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
@ -230,12 +231,13 @@ type httpWriter struct {
|
|||
|
||||
func (h *httpWriter) Write(p []byte) (n int, err error) {
|
||||
if h.writer != nil {
|
||||
_, err = h.writer.Write(p)
|
||||
n, err = h.writer.Write(p)
|
||||
if err != nil {
|
||||
h.writer = nil
|
||||
}
|
||||
return
|
||||
}
|
||||
return len(p), nil
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
func (h *httpWriter) Close() (err error) {
|
||||
|
|
Loading…
Reference in a new issue