Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-01-26 11:20:44 +0300
committerJoas Schilling <coding@schilljs.com>2022-01-26 12:18:23 +0300
commit3ba29c0478eaa54d90d12175e0620ec041827025 (patch)
tree1ecfcbdcf1e89eee8b331b5f9b521abc39f1e009 /lib/Signaling
parent0abdf03ba06a1d6e5878d44c772343a5c8d1adf0 (diff)
Only send 1 HPB request for the "end call for everyone" case
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Signaling')
-rw-r--r--lib/Signaling/Listener.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Signaling/Listener.php b/lib/Signaling/Listener.php
index 829218efc..dce9087a0 100644
--- a/lib/Signaling/Listener.php
+++ b/lib/Signaling/Listener.php
@@ -28,6 +28,8 @@ use OCA\Talk\Config;
use OCA\Talk\Events\AddParticipantsEvent;
use OCA\Talk\Events\ChatEvent;
use OCA\Talk\Events\ChatParticipantEvent;
+use OCA\Talk\Events\EndCallForEveryoneEvent;
+use OCA\Talk\Events\ModifyEveryoneEvent;
use OCA\Talk\Events\ModifyParticipantEvent;
use OCA\Talk\Events\ParticipantEvent;
use OCA\Talk\Events\RemoveParticipantEvent;
@@ -235,6 +237,13 @@ class Listener {
return;
}
+ if ($event instanceof ModifyEveryoneEvent) {
+ // If everyone is disconnected, we will not do O(n) requests.
+ // Instead, the listener of Room::EVENT_AFTER_END_CALL_FOR_EVERYONE
+ // will send all sessions to the HPB with 1 request.
+ return;
+ }
+
/** @var BackendNotifier $notifier */
$notifier = \OC::$server->get(BackendNotifier::class);
@@ -259,6 +268,27 @@ class Listener {
$dispatcher->addListener(Room::EVENT_AFTER_SESSION_UPDATE_CALL_FLAGS, $listener);
$dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, $listener);
+ $dispatcher->addListener(Room::EVENT_AFTER_END_CALL_FOR_EVERYONE, static function (EndCallForEveryoneEvent $event): void {
+ if (self::isUsingInternalSignaling()) {
+ return;
+ }
+
+ $sessionIds = $event->getSessionIds();
+
+ if (empty($sessionIds)) {
+ return;
+ }
+
+ /** @var BackendNotifier $notifier */
+ $notifier = \OC::$server->get(BackendNotifier::class);
+
+ $notifier->roomInCallChanged(
+ $event->getRoom(),
+ $event->getNewValue(),
+ $sessionIds
+ );
+ });
+
$dispatcher->addListener(Room::EVENT_AFTER_GUESTS_CLEAN, static function (RoomEvent $event) {
if (self::isUsingInternalSignaling()) {
return;