mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
fixed checking for proto parsing errors
Former-commit-id: 7831e93bf6c65e574b185d30856af096171b43ac
This commit is contained in:
parent
6db1db3129
commit
91dcbd0758
@ -61,13 +61,9 @@ void ProtoClientConnection::readData()
|
||||
|
||||
// read a message
|
||||
proto::HyperionRequest message;
|
||||
try
|
||||
if (!message.ParseFromArray(_receiveBuffer.data() + 4, messageSize))
|
||||
{
|
||||
message.ParseFromArray(_receiveBuffer.data() + 4, messageSize);
|
||||
}
|
||||
catch(const std::exception & e)
|
||||
{
|
||||
sendErrorReply(std::string("Unable to parse message: ") + e.what());
|
||||
sendErrorReply("Unable to parse message");
|
||||
}
|
||||
|
||||
// handle the message
|
||||
@ -203,7 +199,6 @@ void ProtoClientConnection::sendMessage(const google::protobuf::Message &message
|
||||
std::string serializedReply = message.SerializeAsString();
|
||||
uint32_t size = serializedReply.size();
|
||||
uint8_t sizeData[] = {uint8_t(size >> 24), uint8_t(size >> 16), uint8_t(size >> 8), uint8_t(size)};
|
||||
std::cout << sizeData[0] << " " << sizeData[0] << " " << sizeData[0] << " " << sizeData[0] << " <data>" << std::endl;
|
||||
_socket->write((const char *) sizeData, sizeof(sizeData));
|
||||
_socket->write(serializedReply.data(), serializedReply.length());
|
||||
_socket->flush();
|
||||
|
Loading…
Reference in New Issue
Block a user