don't alloc memory for checkInPacket, make it stack to function

This commit is contained in:
Stephen Birarda 2013-10-25 09:22:23 -07:00
parent 968544152f
commit 9dbbf8c65c

View file

@ -495,7 +495,7 @@ void NodeList::sendDomainServerCheckIn() {
NUM_BYTES_RFC4122_UUID + (2 * (sizeof(uint16_t) + IP_ADDRESS_BYTES)) +
numBytesNodesOfInterest + sizeof(unsigned char);
unsigned char* checkInPacket = new unsigned char[numPacketBytes];
unsigned char checkInPacket[numPacketBytes];
unsigned char* packetPosition = checkInPacket;
PACKET_TYPE nodePacketType = (memchr(SOLO_NODE_TYPES, _ownerType, sizeof(SOLO_NODE_TYPES)))
@ -534,8 +534,6 @@ void NodeList::sendDomainServerCheckIn() {
_nodeSocket.send(_domainIP.toString().toLocal8Bit().constData(), _domainPort, checkInPacket,
packetPosition - checkInPacket);
delete[] checkInPacket; // clean up
const int NUM_DOMAIN_SERVER_CHECKINS_PER_STUN_REQUEST = 5;
static unsigned int numDomainCheckins = 0;