ryanisaacg / archipelago_rs

A Rust library to interface with Archipelago.gg
MIT License
2 stars 6 forks source link

location_scouts and other response-getting helpers loop forever if there's a queued message #5

Open Gaelan opened 1 year ago

Gaelan commented 1 year ago

location_scouts and a few others have a loop of this form:

        while let Some(response) = self.recv().await? {
            match response {
                ServerMessage::LocationInfo(items) => return Ok(items),
                resp => self.message_buffer.push(resp),
            }
        }

The bug is that self.recv() will return anything out of message_buffer before it reads anything from the WebSocket - so if there's already an unrelated message in the buffer when location_scouts is called, it just keeps pulling that message out of and into the buffer, never reading the actual response from the WebSocket.