Commit 90108d7b84
Unsigned
Layout: unified · split
src/room_buffer.rs +4 −4
| @@ -86,7 +86,7 @@ impl BufferInputCallbackAsync for MatrixRoom { | ||
| 86 | 86 | impl RoomBuffer { |
| 87 | 87 | pub fn new( |
| 88 | 88 | server_name: &str, |
| 89 | connected_state: &Rc<RefCell<Option<Connection>>>, | |
| 89 | connection: &Rc<RefCell<Option<Connection>>>, | |
| 90 | 90 | homeserver: &Url, |
| 91 | 91 | room_id: RoomId, |
| 92 | 92 | own_user_id: &UserId, |
| @@ -95,7 +95,7 @@ impl RoomBuffer { | ||
| 95 | 95 | server_name: Rc::new(server_name.to_owned()), |
| 96 | 96 | homeserver: Rc::new(homeserver.clone()), |
| 97 | 97 | room_id: Rc::new(room_id.clone()), |
| 98 | connection: connected_state.clone(), | |
| 98 | connection: connection.clone(), | |
| 99 | 99 | prev_batch: Rc::new(RefCell::new(None)), |
| 100 | 100 | typing_notice_time: Rc::new(RefCell::new(None)), |
| 101 | 101 | room: Rc::new(RefCell::new(Room::new(&room_id, &own_user_id))), |
| @@ -128,12 +128,12 @@ impl RoomBuffer { | ||
| 128 | 128 | pub fn restore( |
| 129 | 129 | room: Room, |
| 130 | 130 | server_name: &str, |
| 131 | connected_state: &Rc<RefCell<Option<Connection>>>, | |
| 131 | connection: &Rc<RefCell<Option<Connection>>>, | |
| 132 | 132 | homeserver: &Url, |
| 133 | 133 | ) -> Self { |
| 134 | 134 | let mut room_buffer = RoomBuffer::new( |
| 135 | 135 | server_name, |
| 136 | connected_state, | |
| 136 | connection, | |
| 137 | 137 | homeserver, |
| 138 | 138 | room.room_id.clone(), |
| 139 | 139 | &room.own_user_id, |
src/server.rs +9 −9
| @@ -184,7 +184,7 @@ pub(crate) struct InnerServer { | ||
| 184 | 184 | config: ConfigHandle, |
| 185 | 185 | client: Option<Client>, |
| 186 | 186 | login_state: Option<LoginInfo>, |
| 187 | connected_state: Rc<RefCell<Option<Connection>>>, | |
| 187 | connection: Rc<RefCell<Option<Connection>>>, | |
| 188 | 188 | server_buffer: Rc<RefCell<Option<BufferHandle>>>, |
| 189 | 189 | } |
| 190 | 190 | |
| @@ -203,7 +203,7 @@ impl MatrixServer { | ||
| 203 | 203 | config: config.clone(), |
| 204 | 204 | client: None, |
| 205 | 205 | login_state: None, |
| 206 | connected_state: Rc::new(RefCell::new(None)), | |
| 206 | connection: Rc::new(RefCell::new(None)), | |
| 207 | 207 | server_buffer: Rc::new(RefCell::new(None)), |
| 208 | 208 | }; |
| 209 | 209 | |
| @@ -448,9 +448,9 @@ impl MatrixServer { | ||
| 448 | 448 | MatrixServer::response_receiver(rx, Rc::downgrade(&self.inner)), |
| 449 | 449 | ); |
| 450 | 450 | |
| 451 | let mut connected_state = server.connected_state.borrow_mut(); | |
| 451 | let mut connection = server.connection.borrow_mut(); | |
| 452 | 452 | |
| 453 | *connected_state = Some(Connection { | |
| 453 | *connection = Some(Connection { | |
| 454 | 454 | client, |
| 455 | 455 | response_receiver, |
| 456 | 456 | runtime, |
| @@ -483,8 +483,8 @@ impl MatrixServer { | ||
| 483 | 483 | |
| 484 | 484 | { |
| 485 | 485 | let server = self.inner(); |
| 486 | let mut connected_state = server.connected_state.borrow_mut(); | |
| 487 | let state = connected_state.take(); | |
| 486 | let mut connection = server.connection.borrow_mut(); | |
| 487 | let state = connection.take(); | |
| 488 | 488 | |
| 489 | 489 | if let Some(s) = state { |
| 490 | 490 | s.response_receiver.cancel(); |
| @@ -691,7 +691,7 @@ impl InnerServer { | ||
| 691 | 691 | .expect("Receiving events while not being logged in"); |
| 692 | 692 | let buffer = RoomBuffer::new( |
| 693 | 693 | &self.server_name, |
| 694 | &self.connected_state, | |
| 694 | &self.connection, | |
| 695 | 695 | homeserver, |
| 696 | 696 | room_id.clone(), |
| 697 | 697 | &login_state.user_id, |
| @@ -722,7 +722,7 @@ impl InnerServer { | ||
| 722 | 722 | let buffer = RoomBuffer::restore( |
| 723 | 723 | room, |
| 724 | 724 | &self.server_name, |
| 725 | &self.connected_state, | |
| 725 | &self.connection, | |
| 726 | 726 | homeserver, |
| 727 | 727 | ); |
| 728 | 728 | |
| @@ -780,7 +780,7 @@ impl InnerServer { | ||
| 780 | 780 | |
| 781 | 781 | /// Is the server connected. |
| 782 | 782 | pub fn connected(&self) -> bool { |
| 783 | self.connected_state.borrow().is_some() | |
| 783 | self.connection.borrow().is_some() | |
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | pub(crate) fn receive_joined_state_event( |