generated from tipragot/rust
Non blocking relay connection #44
|
@ -242,6 +242,8 @@ impl Connection {
|
||||||
/// This function will connect to the relay server if it's not already
|
/// This function will connect to the relay server if it's not already
|
||||||
/// connected, and will send and receive messages from the relay server
|
/// connected, and will send and receive messages from the relay server
|
||||||
/// if it's connected.
|
/// if it's connected.
|
||||||
|
///
|
||||||
|
/// This function will not block the current thread.
|
||||||
pub fn update(&mut self) {
|
pub fn update(&mut self) {
|
||||||
self.state = match std::mem::replace(&mut self.state, ConnectionState::Disconnected) {
|
self.state = match std::mem::replace(&mut self.state, ConnectionState::Disconnected) {
|
||||||
ConnectionState::Disconnected => self.create_stream(),
|
ConnectionState::Disconnected => self.create_stream(),
|
||||||
|
|
Loading…
Reference in a new issue