removed dontSleep from JurisdictionListener

This commit is contained in:
ZappoMan 2014-03-11 21:11:47 -07:00
parent 8befefb054
commit 025da315c6
4 changed files with 2 additions and 16 deletions

View file

@ -19,8 +19,6 @@ JurisdictionListener::JurisdictionListener(NodeType_t type) :
_nodeType(type),
_packetSender(JurisdictionListener::DEFAULT_PACKETS_PER_SECOND)
{
ReceivedPacketProcessor::_dontSleep = true; // we handle sleeping so this class doesn't need to
connect(NodeList::getInstance(), &NodeList::nodeKilled, this, &JurisdictionListener::nodeKilled);
// tell our NodeList we want to hear about nodes with our node type

View file

@ -56,7 +56,6 @@ void PacketSender::queuePacketForSending(const SharedNodePointer& destinationNod
_totalBytesQueued += packet.size();
// Make sure to wake our actual processing thread because we now have packets for it to process.
qDebug() << "PacketSender::queuePacketForSending()... wake up, we need to send packets!.";
_hasPackets.wakeAll();
}
@ -73,7 +72,6 @@ bool PacketSender::process() {
}
void PacketSender::terminating() {
qDebug() << "PacketSender::terminating()... wake up, we need to die.";
_hasPackets.wakeAll();
}
@ -125,9 +123,7 @@ bool PacketSender::threadedProcess() {
// wait till we have packets
_waitingOnPacketsMutex.lock();
qDebug() << "PacketSender::threadedProcess()... waiting on packets to send...";
_hasPackets.wait(&_waitingOnPacketsMutex);
qDebug() << "PacketSender::threadedProcess()... YIPEEE we're awake...";
_waitingOnPacketsMutex.unlock();
}

View file

@ -12,10 +12,6 @@
#include "ReceivedPacketProcessor.h"
#include "SharedUtil.h"
ReceivedPacketProcessor::ReceivedPacketProcessor() {
_dontSleep = false;
}
void ReceivedPacketProcessor::terminating() {
_hasPackets.wakeAll();
}
@ -35,9 +31,7 @@ void ReceivedPacketProcessor::queueReceivedPacket(const SharedNodePointer& desti
bool ReceivedPacketProcessor::process() {
// If a derived class handles process sleeping, like the JurisdiciontListener, then it can set
// this _dontSleep member and we will honor that request.
if (_packets.size() == 0 && !_dontSleep) {
if (_packets.size() == 0) {
_waitingOnPacketsMutex.lock();
_hasPackets.wait(&_waitingOnPacketsMutex);
_waitingOnPacketsMutex.unlock();

View file

@ -19,7 +19,7 @@
/// Generalized threaded processor for handling received inbound packets.
class ReceivedPacketProcessor : public GenericThread {
public:
ReceivedPacketProcessor();
ReceivedPacketProcessor() { }
/// Add packet from network receive thread to the processing queue.
/// \param sockaddr& senderAddress the address of the sender
@ -47,8 +47,6 @@ protected:
virtual void terminating();
bool _dontSleep;
private:
std::vector<NetworkPacket> _packets;