Disconnect on account events
This commit is contained in:
parent
516bb82323
commit
01a442c1f0
1 changed files with 16 additions and 1 deletions
17
src/conn.rs
17
src/conn.rs
|
|
@ -18,7 +18,7 @@ use tokio_tungstenite::{tungstenite, MaybeTlsStream, WebSocketStream};
|
|||
|
||||
use crate::api::packet::{Command, Packet, ParsedPacket};
|
||||
use crate::api::{
|
||||
BounceEvent, Data, HelloEvent, PersonalAccountView, Ping, PingReply, SessionView,
|
||||
BounceEvent, Data, HelloEvent, LoginReply, PersonalAccountView, Ping, PingReply, SessionView,
|
||||
SnapshotEvent, Time, UserId,
|
||||
};
|
||||
use crate::replies::{self, PendingReply, Replies};
|
||||
|
|
@ -300,6 +300,21 @@ impl State {
|
|||
}
|
||||
Status::Joined(joined) => joined.on_data(data),
|
||||
}
|
||||
|
||||
// The euphoria server doesn't always disconnect the client
|
||||
// when it would make sense to do so or when the API
|
||||
// specifies it should. This ensures we always disconnect
|
||||
// when it makes sense to do so.
|
||||
match data {
|
||||
Data::DisconnectEvent(_) => return Err("received disconnect-event".into()),
|
||||
Data::LoginEvent(_) => return Err("received login-event".into()),
|
||||
Data::LogoutEvent(_) => return Err("received logout-event".into()),
|
||||
Data::LoginReply(LoginReply { success: true, .. }) => {
|
||||
return Err("received successful login-reply".into())
|
||||
}
|
||||
Data::LogoutReply(_) => return Err("received logout-reply".into()),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
// Shovel packets into self.packet_tx
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue