Skip to content

Commit

Permalink
Relax the restart request limits (#1106)
Browse files Browse the repository at this point in the history
* Make restart request rate limits configurable.

* Relax restart request rate limits.
  • Loading branch information
bgrozev authored Aug 11, 2023
1 parent e05f8da commit 5bfaea8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
9 changes: 9 additions & 0 deletions jicofo-selector/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ jicofo {
//
// Note: this feature is indented to be removed once older clients (mobile) are phased out.
enable-multi-stream-backward-compat = false

// Rate limits for a participant requesting an ICE restart.
restart-request-rate-limits {
// Never accept a request unless at least `min-interval` has passed since the last request
min-interval = 5 seconds
// Accept at most `max-requests` per `interval`
max-requests = 5
interval = 1 minute
}
}

// Configuration for the internal health checks performed by jicofo.
Expand Down
12 changes: 12 additions & 0 deletions jicofo/src/main/kotlin/org/jitsi/jicofo/ConferenceConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ class ConferenceConfig private constructor() {
}
}

val restartRequestMinInterval: Duration by config {
"jicofo.conference.restart-request-rate-limits.min-interval".from(newConfig)
}

val restartRequestMaxRequests: Int by config {
"jicofo.conference.restart-request-rate-limits.max-requests".from(newConfig)
}

val restartRequestInterval: Duration by config {
"jicofo.conference.restart-request-rate-limits.interval".from(newConfig)
}

/**
* Get the number of milliseconds to delay signaling of Jingle sources given a certain [conferenceSize].
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ open class Participant @JvmOverloads constructor(
*/
private var inviteRunnable: Cancelable? = null

private val restartRequestsRateLimit = RateLimit(clock = clock)
private val restartRequestsRateLimit = RateLimit(
minInterval = ConferenceConfig.config.restartRequestMinInterval,
maxRequests = ConferenceConfig.config.restartRequestMaxRequests,
interval = ConferenceConfig.config.restartRequestInterval,
clock = clock
)

/**
* The Jingle session (if any) established with this peer.
Expand Down

0 comments on commit 5bfaea8

Please sign in to comment.