more verbose errors

This commit is contained in:
Lion Kortlepel 2020-11-06 00:31:35 +01:00
parent f0c87341ab
commit 6a3b933df1

View File

@ -34,7 +34,7 @@ std::string Rcv(SOCKET TCPSock){
uint32_t RealSize;
int64_t BytesRcv = recv(TCPSock, &RealSize, sizeof(RealSize), 0);
if (BytesRcv != sizeof(RealSize)) {
error(Sec("invalid packet (1)"));
error(std::string(Sec("invalid packet: expected 4, got ")) + std::to_string(BytesRcv));
return "";
}
// RealSize is big-endian, so we convert it to host endianness