style: перевести комментарии на русский, убрать очевидные
This commit is contained in:
1 parent
ada9b949a4
commit
e417dac087
48 files changed
+659
-671
No files matched your search
@@ -6,8 +6,8 @@ import (
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
// StreamCredentialsCache holds the resolved TURN creds for a group of streams
|
||||
// plus auth-error tracking for invalidation decisions.
|
||||
// StreamCredentialsCache хранит TURN-реквизиты для группы потоков
|
||||
// и счётчик ошибок для решений об инвалидации.
|
||||
type StreamCredentialsCache struct {
|
||||
creds TurnCredentials
|
||||
mutex sync.RWMutex
|
||||
@@ -15,7 +15,7 @@ type StreamCredentialsCache struct {
|
||||
lastErrorTime atomic.Int64
|
||||
}
|
||||
|
||||
// Store maps cache-id (streamID / streamsPerCache) -> StreamCredentialsCache.
|
||||
// Store отображает cache-id (streamID / streamsPerCache) → StreamCredentialsCache.
|
||||
type Store struct {
|
||||
mu sync.RWMutex
|
||||
caches map[int]*StreamCredentialsCache
|
||||
@@ -57,7 +57,7 @@ func (s *Store) Get(streamID int) *StreamCredentialsCache {
|
||||
return cache
|
||||
}
|
||||
|
||||
// Invalidate clears the creds for the given stream's cache and resets error state.
|
||||
// Invalidate сбрасывает реквизиты кэша потока и обнуляет счётчик ошибок.
|
||||
func (c *StreamCredentialsCache) Invalidate() {
|
||||
c.mutex.Lock()
|
||||
c.creds = TurnCredentials{}
|
||||
@@ -67,8 +67,8 @@ func (c *StreamCredentialsCache) Invalidate() {
|
||||
c.lastErrorTime.Store(0)
|
||||
}
|
||||
|
||||
// IsAuthError matches the historical heuristic used by the TURN client: a TURN
|
||||
// allocate failure mentioning auth/401/stale-nonce should trigger cache invalidate.
|
||||
// IsAuthError проверяет ошибку по эвристике TURN-клиента:
|
||||
// auth/401/stale-nonce — признак инвалидации кэша.
|
||||
func IsAuthError(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
|
||||
Reference in new issue
Block a user