Some work on protocol buffer details.

This commit is contained in:
lotodore
2012-09-23 23:19:53 +02:00
parent e16d4908bd
commit f0ee0af6ec
13 changed files with 1103 additions and 1096 deletions
+3 -2
View File
@@ -84,9 +84,10 @@ void
SenderHelper::InternalStorePacket(SendBuffer &tmpBuffer, boost::shared_ptr<NetPacket> packet)
{
uint32_t packetSize = packet->GetMsg()->ByteSize();
char *buf = new char[packetSize + NET_HEADER_SIZE];
google::protobuf::uint8 *buf = new google::protobuf::uint8[packetSize + NET_HEADER_SIZE];
*((uint32_t *)buf) = htonl(packetSize);
packet->GetMsg()->SerializeToArray(&buf[NET_HEADER_SIZE], packetSize);
packet->GetMsg()->SerializeWithCachedSizesToArray(&buf[NET_HEADER_SIZE]);
SendBuffer::EncodeToBuf(buf, packetSize + NET_HEADER_SIZE, &tmpBuffer);
delete[] buf;
}