···2626 - [x] Lobby tests
2727 - [x] Game end test for actual return from loop
2828 - [x] More transport crate tests
2929- - [ ] Signaling is wrong, only kick everyone else on host leave if the lobby is open
2929+ - [x] Signaling is wrong, only kick everyone else on host leave if the lobby is open
3030 - [x] Organize signalling and seperate out more logic
3131 - [x] Signaling tests
3232 - [ ] Testing crate for integration testing?
+21-1
manhunt-signaling/src/state.rs
···223223 .unwrap_or_default();
224224225225 if host {
226226- if let Some(mat) = matches.get_mut(&removed_peer.room) {
226226+ if let Some(mat) = matches.get_mut(&removed_peer.room).filter(|m| m.open_lobby) {
227227 // If we're host, disconnect everyone else
228228 mat.open_lobby = false;
229229 mat.cancel.cancel();
···458458 let matches = state.matches.lock().unwrap();
459459 let mat = &matches[&code.to_string()];
460460 assert!(mat.cancel.is_cancelled());
461461+ assert!(!mat.open_lobby);
462462+ }
463463+464464+ #[test]
465465+ fn test_host_leave_with_players_but_started() {
466466+ let mut state = ServerState::default();
467467+468468+ let code = "asdfasdfasdfasdf";
469469+470470+ quick_create(&mut state, code, 1);
471471+ quick_join(&mut state, code, 2);
472472+473473+ state.mark_started(&code.to_string());
474474+475475+ let others = state.remove_peer(peer(1), true);
476476+477477+ assert_eq!(others, Some(vec![peer(2)]));
478478+ let matches = state.matches.lock().unwrap();
479479+ let mat = &matches[&code.to_string()];
480480+ assert!(!mat.cancel.is_cancelled());
461481 assert!(!mat.open_lobby);
462482 }
463483