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>2020-04-07 17:27:36 +0300
committerJoas Schilling <coding@schilljs.com>2020-05-12 11:40:19 +0300
commit6ddd276dd0bc8ef91cf1724363f3f33ec38fa8f0 (patch)
tree406e7410c1570acf80f93aece4b4a71b6631d617 /lib/Room.php
parent6c3b4836c49aeab07cd7c84dc25c6756e1b4d2e3 (diff)
Extend the signaling setting API to allow somewhat clustering
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Room.php')
-rw-r--r--lib/Room.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Room.php b/lib/Room.php
index 3e7d2fdd3..9ab23c51e 100644
--- a/lib/Room.php
+++ b/lib/Room.php
@@ -124,6 +124,8 @@ class Room {
private $readOnly;
/** @var int */
private $lobbyState;
+ /** @var int|null */
+ private $assignedSignalingServer;
/** @var \DateTime|null */
private $lobbyTimer;
/** @var string */
@@ -162,6 +164,7 @@ class Room {
int $type,
int $readOnly,
int $lobbyState,
+ ?int $assignedSignalingServer,
string $token,
string $name,
string $password,
@@ -183,6 +186,7 @@ class Room {
$this->type = $type;
$this->readOnly = $readOnly;
$this->lobbyState = $lobbyState;
+ $this->assignedSignalingServer = $assignedSignalingServer;
$this->token = $token;
$this->name = $name;
$this->password = $password;
@@ -224,6 +228,10 @@ class Room {
}
}
+ public function getAssignedSignalingServer(): ?int {
+ return $this->assignedSignalingServer;
+ }
+
public function getToken(): string {
return $this->token;
}
@@ -501,6 +509,19 @@ class Room {
return (bool) $query->execute();
}
+ public function setAssignedSignalingServer(?int $signalingServer): bool {
+ $query = $this->db->getQueryBuilder();
+ $query->update('talk_rooms')
+ ->set('assigned_hpb', $query->createNamedParameter($signalingServer))
+ ->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
+
+ if ($signalingServer !== null) {
+ $query->andWhere($query->expr()->isNull('assigned_hpb'));
+ }
+
+ return (bool) $query->execute();
+ }
+
/**
* @param int $newType Currently it is only allowed to change between `self::GROUP_CALL` and `self::PUBLIC_CALL`
* @return bool True when the change was valid, false otherwise