Skip to content

Commit

Permalink
asserting on protobuf errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Niall Ryan authored and Niall Ryan committed Jul 22, 2010
1 parent a4a3402 commit 47e0d24
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Cpp/ProtoBufRemote/SocketRpcChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ void SocketRpcChannel::Send(const RpcMessage& message)
data.m_size = messageSize + sizeof(int);
data.m_data = new char[data.m_size];
*reinterpret_cast<unsigned int*>(data.m_data) = messageSize;
message.SerializeToArray(data.m_data+sizeof(int), messageSize);

bool isOk = message.SerializeToArray(data.m_data+sizeof(int), messageSize);
assert(isOk);

boost::lock_guard<boost::mutex> lock(m_sendMutex);
m_sendMessages.push(data);
WSASetEvent(m_sendEvent);
Expand Down Expand Up @@ -164,7 +165,8 @@ void SocketRpcChannel::Run()
if (isReceiving)
{
RpcMessage message;
message.ParseFromArray(&receiveBuffer[0], receiveSize);
bool isOk = message.ParseFromArray(&receiveBuffer[0], receiveSize);
assert(isOk);
m_controller->Receive(message);

isReceiving = false;
Expand Down

0 comments on commit 47e0d24

Please sign in to comment.