Commit 4bc43adf13

4bc43adf13986a03494a50e91e71fe602c28dbee

parent: da23d0f62d

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2021-02-02 17:48 UTC

room: Don't hold on to connection borrows across await points

Layout: unified · split

src/room/mod.rs +6 −2
@@ -619,7 +619,9 @@ impl MatrixRoom {
619619 pub async fn send_message(&self, content: MessageEventContent) {
620620 let uuid = Uuid::new_v4();
621621
622 if let Some(c) = &*self.connection.borrow() {
622 let connection = self.connection.borrow().clone();
623
624 if let Some(c) = connection {
623625 self.queue_outgoing_message(uuid, &content).await;
624626 match c
625627 .send_message(
@@ -686,7 +688,9 @@ impl MatrixRoom {
686688 }
687689 };
688690
689 if let Some(connection) = &*connection.borrow() {
691 let connection = connection.borrow().clone();
692
693 if let Some(connection) = connection {
690694 let response =
691695 connection.send_typing_notice(&*room_id, typing).await;
692696