fix parser getting stuck
authoralfadur
Tue, 04 Jun 2019 23:59:16 +0300
changeset 15144 1aa3b44c0441
parent 15143 4f31954a0b81
child 15145 824472aa4d97
fix parser getting stuck
rust/hedgewars-server/src/protocol.rs
--- a/rust/hedgewars-server/src/protocol.rs	Tue Jun 04 23:44:01 2019 +0300
+++ b/rust/hedgewars-server/src/protocol.rs	Tue Jun 04 23:59:16 2019 +0300
@@ -46,7 +46,7 @@
     pub fn extract_messages(&mut self) -> Vec<messages::HwProtocolMessage> {
         let mut messages = vec![];
         if !self.is_recovering {
-            loop {
+            while !self.buf.is_empty() {
                 match parser::message(&self.buf[..]) {
                     Ok((tail, message)) => {
                         messages.push(message);