mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-29 09:28:15 +00:00
Have network_asio not wait forever on invalid package sizes
This commit is contained in:
parent
94ad6e92fd
commit
ddd568fce4
@ -190,6 +190,9 @@ std::size_t connection::is_read_complete(
|
||||
union { char binary[4]; boost::uint32_t num; } data_size;
|
||||
is.read(data_size.binary, 4);
|
||||
bytes_to_read_ = ntohl(data_size.num) + 4;
|
||||
//Close immediately if we receive an invalid length
|
||||
if (bytes_to_read_ < 4)
|
||||
bytes_to_read_ = bytes_transferred;
|
||||
}
|
||||
#if BOOST_VERSION >= 103700
|
||||
return bytes_to_read_ - bytes_transferred;
|
||||
|
Loading…
x
Reference in New Issue
Block a user