fix parser getting stuck
authoralfadur
Tue, 04 Jun 2019 23:59:16 +0300
changeset 15123 1aa3b44c0441
parent 15122 4f31954a0b81
child 15124 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);