fix for possible race condition (that shouldn't have happened in the first place), if writeMaster is being used in queueOnly = false, do an immediate network socket write without attempting to enqueue a message;

pull/51/head
Bryan Biedenkapp 2 years ago
parent 86d736b0bb
commit b7c6282767

@ -327,16 +327,20 @@ bool BaseNetwork::writeMaster(FrameQueue::OpcodePair opcode, const uint8_t* data
uint16_t port = udp::Socket::port(m_addr) + 1U;
if (udp::Socket::lookup(address, port, addr, addrLen) == 0) {
m_frameQueue->enqueueMessage(data, length, streamId, m_peerId, opcode, pktSeq, addr, addrLen);
if (!queueOnly)
return m_frameQueue->write(data, length, streamId, m_peerId, m_peerId, opcode, pktSeq, addr, addrLen);
else
m_frameQueue->enqueueMessage(data, length, streamId, m_peerId, opcode, pktSeq, addr, addrLen);
}
}
else {
m_frameQueue->enqueueMessage(data, length, streamId, m_peerId, opcode, pktSeq, m_addr, m_addrLen);
if (!queueOnly)
return m_frameQueue->write(data, length, streamId, m_peerId, m_peerId, opcode, pktSeq, m_addr, m_addrLen);
else
m_frameQueue->enqueueMessage(data, length, streamId, m_peerId, opcode, pktSeq, m_addr, m_addrLen);
}
if (queueOnly)
return true;
return m_frameQueue->flushQueue();
return true;
}
/// <summary>

Loading…
Cancel
Save

Powered by TurnKey Linux.