fix(relay): восстановление потоков при отказах turn и занятой квоте
This commit is contained in:
1 parent
e72157f4f7
commit
6570cd9dd7
12 files changed
+117
-12
No files matched your search
@@ -10,7 +10,9 @@ import (
|
||||
const (
|
||||
permFailMarker = "Failed to bind channel"
|
||||
permOKMarker = "Channel binding successful"
|
||||
turncScope = "turnc"
|
||||
// Refresh сообщает об отказе раньше очередного ChannelBind.
|
||||
allocFailMarker = "Failed to refresh allocation"
|
||||
turncScope = "turnc"
|
||||
// permFailThreshold - число последовательных провалов ChannelBind refresh до срабатывания onDead.
|
||||
permFailThreshold = 2
|
||||
)
|
||||
@@ -40,6 +42,14 @@ type permWatchLogger struct {
|
||||
|
||||
func (l *permWatchLogger) note(msg string) {
|
||||
switch {
|
||||
case strings.Contains(msg, allocFailMarker):
|
||||
l.mu.Lock()
|
||||
fire := !l.fired
|
||||
l.fired = true
|
||||
l.mu.Unlock()
|
||||
if fire && l.f.onDead != nil {
|
||||
l.f.onDead()
|
||||
}
|
||||
case strings.Contains(msg, permFailMarker):
|
||||
l.mu.Lock()
|
||||
l.fails++
|
||||
|
||||
Reference in new issue
Block a user