mirror of
https://github.com/strukturag/nextcloud-spreed-signaling.git
synced 2023-10-21 07:33:40 -05:00
Implement per-backend session limit for clusters.
This commit is contained in:
@@ -42,10 +42,11 @@ var (
|
||||
)
|
||||
|
||||
type Backend struct {
|
||||
id string
|
||||
url string
|
||||
secret []byte
|
||||
compat bool
|
||||
id string
|
||||
url string
|
||||
parsedUrl *url.URL
|
||||
secret []byte
|
||||
compat bool
|
||||
|
||||
allowHttp bool
|
||||
|
||||
@@ -80,6 +81,24 @@ func (b *Backend) IsUrlAllowed(u *url.URL) bool {
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Backend) Url() string {
|
||||
return b.url
|
||||
}
|
||||
|
||||
func (b *Backend) ParsedUrl() *url.URL {
|
||||
return b.parsedUrl
|
||||
}
|
||||
|
||||
func (b *Backend) Limit() int {
|
||||
return int(b.sessionLimit)
|
||||
}
|
||||
|
||||
func (b *Backend) Len() int {
|
||||
b.sessionsLock.Lock()
|
||||
defer b.sessionsLock.Unlock()
|
||||
return len(b.sessions)
|
||||
}
|
||||
|
||||
func (b *Backend) AddSession(session Session) error {
|
||||
if session.ClientType() == HelloClientTypeInternal || session.ClientType() == HelloClientTypeVirtual {
|
||||
// Internal and virtual sessions are not counting to the limit.
|
||||
|
||||
Reference in New Issue
Block a user