fix pvp instance state push notification
This commit is contained in:
@@ -185,8 +185,9 @@ pub fn set_password(tx: &mut Transaction, id: Uuid, current: &String, password:
|
||||
let id: Uuid = row.get(0);
|
||||
let db_pw: String = row.get(1);
|
||||
|
||||
// return bad request to prevent being logged out
|
||||
if !verify(current, &db_pw)? {
|
||||
return Err(MnmlHttpError::PasswordNotMatch);
|
||||
return Err(MnmlHttpError::BadRequest);
|
||||
}
|
||||
|
||||
let rounds = 8;
|
||||
|
||||
@@ -724,7 +724,7 @@ pub fn instance_ready(tx: &mut Transaction, account: &Account, instance_id: Uuid
|
||||
Ok(RpcMessage::InstanceState(instance_update(tx, instance)?))
|
||||
}
|
||||
|
||||
pub fn instance_state(tx: &mut Transaction, _account: &Account, instance_id: Uuid) -> Result<RpcMessage, Error> {
|
||||
pub fn instance_state(tx: &mut Transaction, instance_id: Uuid) -> Result<RpcMessage, Error> {
|
||||
let instance = instance_get(tx, instance_id)?;
|
||||
|
||||
if let Some(game_id) = instance.current_game_id() {
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ fn handle_notification(n: Notification, pool: &PgPool, events: &Sender<Event>) {
|
||||
Table::Accounts =>
|
||||
Some(Event::Push(n.id, RpcMessage::AccountState(account::select(&db, n.id).unwrap()))),
|
||||
Table::Instances =>
|
||||
Some(Event::Push(n.id, RpcMessage::InstanceState(instance::instance_get(&mut tx, n.id).unwrap()))),
|
||||
Some(Event::Push(n.id, instance::instance_state(&mut tx, n.id).unwrap())),
|
||||
Table::Games =>
|
||||
Some(Event::Push(n.id, RpcMessage::GameState(game::game_get(&mut tx, n.id).unwrap()))),
|
||||
_ => {
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ impl Connection {
|
||||
RpcRequest::InstanceReady { instance_id } =>
|
||||
Ok(instance_ready(&mut tx, account, instance_id)?),
|
||||
RpcRequest::InstanceState { instance_id } =>
|
||||
Ok(instance_state(&mut tx, account, instance_id)?),
|
||||
Ok(instance_state(&mut tx, instance_id)?),
|
||||
|
||||
RpcRequest::VboxAccept { instance_id, group, index } =>
|
||||
Ok(RpcMessage::InstanceState(vbox_accept(&mut tx, account, instance_id, group, index)?)),
|
||||
|
||||
Reference in New Issue
Block a user