Commit da23d0f62d
Unsigned
Layout: unified · split
src/server.rs +10 −3
| @@ -439,6 +439,14 @@ impl MatrixServer { | |||
| 439 | } | 439 | } |
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | fn set_connection(&self, connection: Connection) { | ||
| 443 | *self.inner.borrow_mut().connection.borrow_mut() = Some(connection); | ||
| 444 | } | ||
| 445 | |||
| 446 | fn get_or_create_client(&self) -> Result<Client, ServerError> { | ||
| 447 | self.inner.borrow_mut().get_or_create_client() | ||
| 448 | } | ||
| 449 | |||
| 442 | /// Check if the provided value is a valid URL. | 450 | /// Check if the provided value is a valid URL. |
| 443 | fn is_url_valid(value: &str) -> bool { | 451 | fn is_url_valid(value: &str) -> bool { |
| 444 | if value.is_empty() { | 452 | if value.is_empty() { |
| @@ -605,10 +613,9 @@ impl MatrixServer { | |||
| 605 | return Ok(()); | 613 | return Ok(()); |
| 606 | } | 614 | } |
| 607 | 615 | ||
| 608 | let client = self.inner.borrow_mut().get_or_create_client()?; | 616 | let client = self.get_or_create_client()?; |
| 609 | let connection = Connection::new(&self, &client); | 617 | let connection = Connection::new(&self, &client); |
| 610 | 618 | self.set_connection(connection); | |
| 611 | *self.inner.borrow_mut().connection.borrow_mut() = Some(connection); | ||
| 612 | 619 | ||
| 613 | self.print_network(&format!( | 620 | self.print_network(&format!( |
| 614 | "Connected to {}{}{}", | 621 | "Connected to {}{}{}", |