From 3fc8499539471b376d8a5d2ccf6bdc37ca498c18 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 12 Dec 2023 14:54:21 +0100 Subject: [PATCH] Temp Signed-off-by: Joas Schilling --- lib/Activity/Listener.php | 7 ++++++- lib/Controller/CallController.php | 11 +++++++++-- lib/Listener/RestrictStartingCalls.php | 6 ++++++ lib/Notification/Listener.php | 9 +++++++++ lib/Service/ParticipantService.php | 24 +++++++++++++++++++++--- 5 files changed, 51 insertions(+), 6 deletions(-) diff --git a/lib/Activity/Listener.php b/lib/Activity/Listener.php index 2147767fe79..bf49c60b58a 100644 --- a/lib/Activity/Listener.php +++ b/lib/Activity/Listener.php @@ -74,6 +74,9 @@ public function handle(Event $event): void { } protected function setActive(ParticipantModifiedEvent $event): void { + if ($event->getRoom()->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #8: ' . microtime(true)); + } if ($event->getProperty() !== AParticipantModifiedEvent::PROPERTY_IN_CALL) { return; } @@ -82,7 +85,6 @@ protected function setActive(ParticipantModifiedEvent $event): void { || $event->getNewValue() === Participant::FLAG_DISCONNECTED) { return; } - $participant = $event->getParticipant(); $this->roomService->setActiveSince( $event->getRoom(), @@ -90,6 +92,9 @@ protected function setActive(ParticipantModifiedEvent $event): void { $participant->getSession() ? $participant->getSession()->getInCall() : Participant::FLAG_DISCONNECTED, $participant->getAttendee()->getActorType() !== Attendee::ACTOR_USERS ); + if ($event->getRoom()->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #9: ' . microtime(true)); + } } protected function handleParticipantModified(ParticipantModifiedEvent $event): void { diff --git a/lib/Controller/CallController.php b/lib/Controller/CallController.php index d669e90ae3e..7521506021d 100644 --- a/lib/Controller/CallController.php +++ b/lib/Controller/CallController.php @@ -141,6 +141,9 @@ public function getPeersForCall(): DataResponse { #[RequireParticipant] #[RequireReadWriteConversation] public function joinCall(?int $flags = null, ?int $forcePermissions = null, bool $silent = false, bool $recordingConsent = false): DataResponse { + if ($this->room->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #0: ' . microtime(true)); + } if (!$recordingConsent && $this->talkConfig->recordingConsentRequired() !== RecordingService::CONSENT_REQUIRED_NO) { if ($this->talkConfig->recordingConsentRequired() === RecordingService::CONSENT_REQUIRED_YES) { return new DataResponse(['error' => 'consent'], Http::STATUS_BAD_REQUEST); @@ -169,9 +172,13 @@ public function joinCall(?int $flags = null, ?int $forcePermissions = null, bool if ($forcePermissions !== null && $this->participant->hasModeratorPermissions()) { $this->roomService->setPermissions($this->room, 'call', Attendee::PERMISSIONS_MODIFY_SET, $forcePermissions, true); } - + if ($this->room->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #1: ' . microtime(true)); + } $joined = $this->participantService->changeInCall($this->room, $this->participant, $flags, false, $silent); - + if ($this->room->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #2: ' . microtime(true)); + } if (!$joined) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } diff --git a/lib/Listener/RestrictStartingCalls.php b/lib/Listener/RestrictStartingCalls.php index 80d13d89695..6a3b6eaea9e 100644 --- a/lib/Listener/RestrictStartingCalls.php +++ b/lib/Listener/RestrictStartingCalls.php @@ -53,6 +53,9 @@ public function handle(Event $event): void { if (!$event instanceof BeforeParticipantModifiedEvent) { return; } + if ($event->getRoom()->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #10: ' . microtime(true)); + } if ($event->getProperty() !== AParticipantModifiedEvent::PROPERTY_IN_CALL) { return; @@ -74,5 +77,8 @@ public function handle(Event $event): void { && !$this->participantService->hasActiveSessionsInCall($room)) { throw new ForbiddenException('Can not start a call'); } + if ($event->getRoom()->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #11: ' . microtime(true)); + } } } diff --git a/lib/Notification/Listener.php b/lib/Notification/Listener.php index b078879e90f..8c584eb8736 100644 --- a/lib/Notification/Listener.php +++ b/lib/Notification/Listener.php @@ -227,10 +227,19 @@ protected function afterParticipantJoinedCall(ParticipantModifiedEvent $event): return; } + if ($event->getRoom()->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #12: ' . microtime(true)); + } $this->markCallNotificationsRead($event->getRoom()); + if ($event->getRoom()->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #13: ' . microtime(true)); + } if ($this->shouldSendCallNotification) { $this->sendCallNotifications($event->getRoom()); } + if ($event->getRoom()->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #14: ' . microtime(true)); + } } /** diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index 0b652a3f2dc..3bb32352fde 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -1155,6 +1155,9 @@ public function endCallForEveryone(Room $room, Participant $moderator): void { } public function changeInCall(Room $room, Participant $participant, int $flags, bool $endCallForEveryone = false, bool $silent = false): bool { + if ($room->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #3: ' . microtime(true)); + } if ($room->getType() === Room::TYPE_CHANGELOG || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER || $room->getType() === Room::TYPE_NOTE_TO_SELF) { @@ -1177,6 +1180,9 @@ public function changeInCall(Room $room, Participant $participant, int $flags, b $oldFlags = $session->getInCall(); $details = []; + if ($room->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #4: ' . microtime(true)); + } if ($flags !== Participant::FLAG_DISCONNECTED) { if ($silent) { $legacyEvent = new SilentModifyParticipantEvent($room, $participant, 'inCall', $flags, $session->getInCall()); @@ -1194,10 +1200,14 @@ public function changeInCall(Room $room, Participant $participant, int $flags, b } $this->dispatcher->dispatch(Room::EVENT_BEFORE_SESSION_LEAVE_CALL, $legacyEvent); } - + if ($room->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #4.1: ' . microtime(true)); + } $event = new BeforeParticipantModifiedEvent($room, $participant, AParticipantModifiedEvent::PROPERTY_IN_CALL, $flags, $oldFlags, $details); $this->dispatcher->dispatchTyped($event); - + if ($room->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #5: ' . microtime(true)); + } $session->setInCall($flags); if (!$endCallForEveryone) { $this->sessionMapper->update($session); @@ -1211,14 +1221,22 @@ public function changeInCall(Room $room, Participant $participant, int $flags, b $attendee->setCallId(''); $this->attendeeMapper->update($attendee); } - + if ($room->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #6: ' . microtime(true)); + } if ($flags !== Participant::FLAG_DISCONNECTED) { $this->dispatcher->dispatch(Room::EVENT_AFTER_SESSION_JOIN_CALL, $legacyEvent); } else { $this->dispatcher->dispatch(Room::EVENT_AFTER_SESSION_LEAVE_CALL, $legacyEvent); } + if ($room->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #6.1: ' . microtime(true)); + } $event = new ParticipantModifiedEvent($room, $participant, AParticipantModifiedEvent::PROPERTY_IN_CALL, $flags, $oldFlags, $details); $this->dispatcher->dispatchTyped($event); + if ($room->getToken() === 'c9bui2ju') { + \OC::$server->getLogger()->warning('Debugging step #7: ' . microtime(true)); + } return true; }