Update of bug #21459 (project wesnoth): Status: None => In Progress Assigned to: None => involution
_______________________________________________________ Follow-up Comment #2: I think that the source of the bug is the following (see https://github.com/wesnoth/wesnoth-old/blob/master/src/playsingle_controller.cpp#L654 for reference) Whenever a human side (controlled by local player, not a remote one) begins its turn, the client will have 'current_team().is_human() = true' and will execute the try/catch block there, including 'before_human_turn()' which inserts the init_side command, and then play_turn which watches for and executes actions. When control of the current side is changed, we have to escape the play_turn function and start over. So the function play_human_turn in playmp_controller.cpp, which handles when the local human is moving, has to throw an "end_turn_exception" when it detects that the turn needs to be restarted. https://github.com/wesnoth/wesnoth-old/blob/master/src/playmp_controller.cpp#L208 Since this is the mechanism to give control, it creates the possibility that a side will be initialized twice and cause an error. There are various mechanisms in the code right now to try to prevent that, but I believe that the server errors you are seeing, even the ones ostensibly related to whiteboard, are probably caused by sides being initialized twice, in an odd edge case. Most of the cases work out right now -- when a client drops before sending their init signal, we are fine. When the host transfers control on their turn, there are functions "maybe_do_init" that seem to try to check if they should init again or not: https://github.com/wesnoth/wesnoth-old/blob/master/src/playturn.cpp#L296 (But I'm not sure if that's the right place to do that, as the side will still get reinitialized anyway if it goes to a human in playmp_controller.) Right now I think that the bad scenario is probably that when the host leaves and a new host is elected, that player immediately becomes the human controller of the abandoned sides, and issues init sides commands. Then they see the dialog to decide what to do with the sides, and if they give them to another player then most likely that player will also initialize them. I'm not sure if it will fix the bug, but I'm going to change the system so that 1.) abandoned sides are idle rather than controlled by the host, 2.) idle sides are not initialized on the start of their turn. _______________________________________________________ Reply to this item at: <http://gna.org/bugs/?21459> _______________________________________________ Message sent via/by Gna! http://gna.org/ _______________________________________________ Wesnoth-bugs mailing list Wesnoth-bugs@gna.org https://mail.gna.org/listinfo/wesnoth-bugs