Example #1
0
void 
Event::serialize( SerializedInstance *addTo ) const {
  addTo->addSerializable( &getSendTime() );
  addTo->addSerializable( &getReceiveTime() );
  addTo->addUnsigned( getSender().getSimulationManagerID() );
  addTo->addUnsigned( getSender().getSimulationObjectID() );
  addTo->addUnsigned( getReceiver().getSimulationManagerID() );
  addTo->addUnsigned( getReceiver().getSimulationObjectID() );
  addTo->addUnsigned( getEventId().val );
}
Example #2
0
bool ActiveTrade::bothCanTrade() {
	if (!canTrade(getSender(), getReceiverTrade())) {
		return false;
	}
	if (!canTrade(getReceiver(), getSenderTrade())) {
		return false;
	}
	return true;
}
Example #3
0
void WdtResourceControllerTest::ReleaseStaleTest() {
  int maxNamespaces = 2;
  string transferPrefix = "add-objects-limit-transfer";
  for (int namespaceNum = 1; namespaceNum <= maxNamespaces; namespaceNum++) {
    string wdtNamespace = "test-namespace-" + to_string(namespaceNum);
    registerWdtNamespace(wdtNamespace);
  }
  int index = 0;
  {
    string wdtNamespace = "test-namespace-1";
    auto transferRequest =
        makeTransferRequest(getTransferId(transferPrefix, index));
    ReceiverPtr receiverPtr;
    ErrorCode code = createReceiver(wdtNamespace, transferRequest.transferId,
                                    transferRequest, receiverPtr);
    ASSERT_TRUE(code == OK);
    ASSERT_TRUE(receiverPtr != nullptr);
    SenderPtr senderPtr;
    code = createSender(wdtNamespace, transferRequest.transferId,
                        transferRequest, senderPtr);
    ASSERT_TRUE(code == OK);
    ASSERT_TRUE(senderPtr != nullptr);
    index++;
  }
  ASSERT_TRUE(numSenders_ == 1);
  ASSERT_TRUE(numReceivers_ == 1);
  releaseAllSenders("test-namespace-1");
  releaseAllReceivers("test-namespace-1");
  ASSERT_TRUE(numSenders_ == 0);
  ASSERT_TRUE(numReceivers_ == 0);
  {
    string wdtNamespace = "test-namespace-1";
    auto transferRequest =
        makeTransferRequest(getTransferId(transferPrefix, index));
    ReceiverPtr receiverPtr;
    ErrorCode code = createReceiver(wdtNamespace, transferRequest.transferId,
                                    transferRequest, receiverPtr);
    ASSERT_TRUE(code == OK);
    ASSERT_TRUE(receiverPtr != nullptr);
    SenderPtr senderPtr;
    code = createSender(wdtNamespace, transferRequest.transferId,
                        transferRequest, senderPtr);
    ASSERT_TRUE(code == OK);
    ASSERT_TRUE(senderPtr != nullptr);
    senderPtr = getSender(wdtNamespace, getTransferId(transferPrefix, index));
    receiverPtr =
        getReceiver(wdtNamespace, getTransferId(transferPrefix, index));
    ASSERT_TRUE(senderPtr != nullptr);
    ASSERT_TRUE(receiverPtr != nullptr);
    code = releaseReceiver(wdtNamespace, getTransferId(transferPrefix, index));
    EXPECT_EQ(code, OK);
    code = releaseReceiver(wdtNamespace, getTransferId(transferPrefix, index));
    ASSERT_TRUE(code != OK);
    index++;
  }
}
Example #4
0
void ActiveTrade::swapTrade() {
	TradeInfo *send = getSenderTrade();
	TradeInfo *recv = getReceiverTrade();
	Player *one = getSender();
	Player *two = getReceiver();
	giveItems(one, recv);
	giveItems(two, send);
	giveMesos(one, recv, true);
	giveMesos(two, send, true);
}
EvolverController::EvolverController() : Supervisor(),
logger(Logger::getInstance("EvolverController"))
{
    // setup shape encoding
    if (SHAPE_ENCODING == "CPPN")
    {
        genomeManager = new CppnGenomeManager();
    }
    else
    {
        // set genomeManager for other kind of genome
        logger.errorStream() << "Unknown Shape Encoding: " << SHAPE_ENCODING;
    }
    
    if (MIND_ENCODING == "RLPOWER") {
        mindGenomeManager = new MatrixGenomeManager();
    }
    else
    {
        logger.errorStream() << "Unknown Mind Encoding: " << MIND_ENCODING;
    }
    
    if(PARENT_SELECTION == "BESTTWO") {
        parentSelectionMechanism = new BestTwoParentSelection();
    } else if(PARENT_SELECTION == "BINARY_TOURNAMENT"){
        parentSelectionMechanism = new BinaryTournamentParentSelection();
    } else if (PARENT_SELECTION == "RANDOM") {
        parentSelectionMechanism = new RandomSelection();
    } else {
        logger.errorStream() << "Unknown Parent Selection Mechanism: " << PARENT_SELECTION;
    }
    
    if(MATING_SELECTION == "EVOLVER") {
        matingType = MATING_SELECTION_BY_EVOLVER;
    } else if(MATING_SELECTION == "ORGANISMS"){
        matingType = MATING_SELECTION_BY_ORGANISMS;
    } else {
        logger.errorStream() << "Unknown Mating Selection Mechanism: " << MATING_SELECTION;
    }
    
    if(DEATH_SELECTION == "EVOLVER") {
        deathType = DEATH_SELECTION_BY_EVOLVER;
    } else if(DEATH_SELECTION == "TIME_TO_LIVE"){
        deathType = DEATH_SELECTION_BY_TIME_TO_LIVE;
    } else {
        logger.errorStream() << "Unknown Death Selection Mechanism: " << DEATH_SELECTION;
    }
    
    emitter = getEmitter(EMITTER_NAME);
    emitter->setChannel(CLINIC_CHANNEL);
    receiver = getReceiver(RECEIVER_NAME);
    receiver->setChannel(EVOLVER_CHANNEL);
    
    builder = new Builder();
}
Example #6
0
Robot::Robot()
{
  InMapFile cm("Processes/connect.cfg");
  ASSERT(cm.exists());

  // attach receivers to senders
  ConnectionParameter cp;
  cm >> cp;
  for(std::vector<ConnectionParameter::ProcessConnection>::const_iterator it = cp.processConnections.begin(); it != cp.processConnections.end(); ++it)
  {
    connect(getSender(it->sender.c_str()), getReceiver(it->receiver.c_str()));
  }
}
Example #7
0
Robot::Robot(const std::string& name) :
  name(name)
{
  InMapFile cm("processes.cfg");
  ASSERT(cm.exists());

  // attach receivers to senders
  ConnectionParameter cp;
  cm >> cp;
  for(std::vector<ConnectionParameter::ProcessConnection>::const_iterator it = cp.processConnections.begin(); it != cp.processConnections.end(); ++it)
  {
    connect(getSender(it->sender.c_str()), getReceiver(it->receiver.c_str()));
  }

  // connect additional senders and receivers
  connect(getSender("Debug.MessageQueue"), getReceiver("LocalRobot.MessageQueue"));
  connect(getSender("LocalRobot.MessageQueue"), getReceiver("Debug.MessageQueue"));

  for(ProcessList::const_iterator i = begin(); i != end() && !robotProcess; ++i)
    robotProcess = (LocalRobot*)(*i)->getProcess("LocalRobot");
  ASSERT(robotProcess);
}
Example #8
0
void ActiveTrade::returnTrade() {
	TradeInfo *send = getSenderTrade();
	TradeInfo *recv = getReceiverTrade();
	Player *one = getSender();
	Player *two = getReceiver();
	if (one != nullptr) {
		giveItems(one, send);
		giveMesos(one, send);
	}
	if (two != nullptr) {
		giveItems(two, recv);
		giveMesos(two, recv);
	}
}
Example #9
0
bool Mailbox::sendItem(Item* item)
{
	std::string receiver = std::string("");

	if (!getReceiver(item, receiver)) {
		return false;
	}

	/**No need to continue if its still empty**/
	if (receiver.empty()) {
		return false;
	}

	uint32_t guid;

	if (!IOLoginData::getInstance()->getGuidByName(guid, receiver)) {
		return false;
	}

	Player* player = g_game.getPlayerByName(receiver);

	if (player) {
		if (g_game.internalMoveItem(item->getParent(), player->getInbox(), INDEX_WHEREEVER,
		                            item, item->getItemCount(), NULL, FLAG_NOLIMIT) == RET_NOERROR) {
			g_game.transformItem(item, item->getID() + 1);
			player->onReceiveMail();
			return true;
		}
	} else {
		player = new Player(receiver, NULL);

		if (!IOLoginData::getInstance()->loadPlayer(player, receiver)) {
			delete player;
			return false;
		}

		if (g_game.internalMoveItem(item->getParent(), player->getInbox(), INDEX_WHEREEVER,
		                            item, item->getItemCount(), NULL, FLAG_NOLIMIT) == RET_NOERROR) {
			g_game.transformItem(item, item->getID() + 1);
			IOLoginData::getInstance()->savePlayer(player);
			delete player;
			return true;
		}

		delete player;
	}

	return false;
}
Example #10
0
Robot::Robot()
{

  InConfigFile stream("Processes/CMD/connect.cfg");
  ASSERT(stream.exists());

  // attach receivers to senders
  std::string senderName,
              receiverName;
  while(!stream.eof())
  {
    stream >> senderName >> receiverName;
    connect(getSender(senderName.c_str()), getReceiver(receiverName.c_str()));
  }
}
void CameraController::initialize() {
    std::cout << "Initializing robot: " << getName() << std::endl;
    emitter = getEmitter("Emitter");
    receiver = getReceiver("Receiver");
    
    TIME_STEP = getBasicTimeStep();
    
    type = parameters->get<int>("Robot." + getName() + ".Type");
    robotIndex = parameters->get<std::size_t>("Robot."+ getName() +".Index");
    
    // Battery is rated in joules here for easy conversion from the motor work
    // Battery specifications are usually in mAh (milliamp-hours).
    // To convert you need the nominal voltage.
    //
    // Reminder:
    // 1 Joule = 1 Newton Meter  ( kg * m^2 / s^2 )
    // 1 Watt-hour = 3600 Joules
    //
    // Roombot battery is 1200 mAh @ 12 V (taken from http://biorob.epfl.ch/roombots )
    // so 1200 mAh * 12 V / 1000 = 14.4 watt-hours (12V taken from https://fmcc.faulhaber.com/details/overview/PGR_3877_13818/PGR_13818_13813/en/ )
    // * 3600 = 51840 Joules
    batteryMax = ((1200 * 12) / 1000) * 3600;
    // Multiply by the number of modules to simulate power sharing
    batteryMax = batteryMax * parameters->get<int>("Robot.Modules_#");
    battery = batteryMax;
    
    // initialization for non-root module
    if (!isRoot()) {
        // set non-root module's emitter and receiver using the intex of the root
        emitter->setChannel(1);
        receiver->setChannel(2);
        receiver->enable(TIME_STEP);
        
        return;
    } else {
        // set root module's emitter and receiver as inverse of the ones for non-root modules
        // in order to make possible the communitation between master and slave
        emitter->setChannel(2);
        receiver->setChannel(1);
        receiver->enable(TIME_STEP);
    }
}
Example #12
0
static bool qobjectDisconnectCallback(QObject* source, const char* signal, PyObject* callback)
{
    if (!PySide::Signal::checkQtSignal(signal))
        return false;

    PySide::SignalManager& signalManager = PySide::SignalManager::instance();

    // Extract receiver from callback
    QObject* receiver = 0;
    PyObject* self = 0;
    bool usingGlobalReceiver = getReceiver(NULL, callback, &receiver, &self);
    if (receiver == 0 && self == 0)
        return false;

    const QMetaObject* metaObject = receiver->metaObject();
    int signalIndex = source->metaObject()->indexOfSignal(++signal);
    int slotIndex = -1;

    const QByteArray callbackSig = PySide::Signal::getCallbackSignature(signal, receiver, callback, usingGlobalReceiver).toAscii();
    QByteArray qtSlotName(callbackSig);

    slotIndex = metaObject->indexOfSlot(qtSlotName);

    if (QMetaObject::disconnectOne(source, signalIndex, receiver, slotIndex)) {
        if (usingGlobalReceiver)
            signalManager.releaseGlobalReceiver(source, receiver);

        #ifndef AVOID_PROTECTED_HACK
            source->disconnectNotify(qtSlotName);
        #else
            // Need to cast to QObjectWrapper* and call the public version of
            // connectNotify when avoiding the protected hack.
            reinterpret_cast<QObjectWrapper*>(source)->disconnectNotify(qtSlotName);
        #endif
        return true;
    }
    return false;
}
Example #13
0
bool Mailbox::sendItem(Item* item)
{
	std::string receiver = std::string("");
	uint32_t dp = 0;

	if(!getReceiver(item, receiver, dp))
		return false;

	/**No need to continue if its still empty**/
	if(receiver == "" || dp == 0)
		return false;

	uint32_t guid;
	if(!IOLoginData::getInstance()->getGuidByName(guid, receiver))
		return false;

	if(Player* player = g_game.getPlayerByName(receiver))
	{
		Depot* depot = player->getDepot(dp, true);
		if(depot)
		{
			if(g_game.internalMoveItem(item->getParent(), depot, INDEX_WHEREEVER,
				item, item->getItemCount(), NULL, FLAG_NOLIMIT) == RET_NOERROR)
			{
				g_game.transformItem(item, item->getID() + 1);
				player->onReceiveMail(dp);
				player->setDepotChange(true);
				return true;
			}
		}
	}
	else if(IOLoginData::getInstance()->playerExists(receiver))
	{
		Player* player = new Player(receiver, NULL);
		if(!IOLoginData::getInstance()->loadPlayer(player, receiver))
		{
			#ifdef __DEBUG_MAILBOX__
			std::cout << "Failure: [Mailbox::sendItem], can not load player: " << receiver << std::endl;
			#endif
			delete player;
			return false;
		}

		#ifdef __DEBUG_MAILBOX__
		std::string playerName = player->getName();
		if(g_game.getPlayerByName(playerName))
		{
			std::cout << "Failure: [Mailbox::sendItem], receiver is online: " << receiver << "," << playerName << std::endl;
			delete player;
			return false;
		}
		#endif

		Depot* depot = player->getDepot(dp, true);
		if(depot)
		{
			if(g_game.internalMoveItem(item->getParent(), depot, INDEX_WHEREEVER,
				item, item->getItemCount(), NULL, FLAG_NOLIMIT) == RET_NOERROR)
			{
				g_game.transformItem(item, item->getID() + 1);
				player->setDepotChange(true);
				IOLoginData::getInstance()->savePlayer(player, true);
				delete player;
				return true;
			}
		}
		delete player;
	}
	return false;
}
Example #14
0
int SendTempSessionTextIMPacket::putBody(unsigned char *buf) 
{
	int pos=0;
	buf[pos++]=subcommand;
	char* pszPos;
	int rev;
	unsigned short sht;

	switch(subcommand) {
			case QQ_SUB_CMD_SEND_TEMP_SESSION_IM:
				// ������
				rev=htonl(getReceiver());
				memmove(buf+pos,&rev,4);
				pos+=4;
				// authinfo
				sht=htons(authInfoSize);
				memmove(buf+pos,&sht,2);
				pos+=2;
				memmove(buf+pos,authInfo,authInfoSize);
				pos+=authInfoSize;
				// ����
				memset(buf+pos,0,4);
				pos+=4;
				// nick
				buf[pos++]=(unsigned char) strlen(nick.c_str());
				memmove(buf+pos,nick.c_str(),strlen(nick.c_str()));
				pos+=strlen(nick.c_str());
				// site name
				buf[pos++]=(unsigned char) strlen(site.c_str());
				memmove(buf+pos,site.c_str(),strlen(site.c_str()));
				pos+=strlen(site.c_str());
				// ����
				buf[pos++]=2;
				// ����
				memset(buf+pos,0,4);
				pos+=4;
				// �c�סA�̦Z�A��E
				pszPos=(char*)buf+pos;
				pos+=2;
				// �����X�e
				memmove(buf+pos,message.c_str(),strlen(message.c_str()));
				pos+=strlen(message.c_str());
				buf[pos++]=0x20;
				// �r�^�p��
				buf[pos++] = 0x00;    //  C style string terminator

				buf[pos++] = fontFlag;
				buf[pos++] = red;
				buf[pos++] = green;
				buf[pos++] = blue;

				buf[pos++] = 0;

				short tmpEncoding = htons(encoding);  // encoding for text
				memcpy(buf+pos,&tmpEncoding, 2);
				pos+=2;

				int len = fontName.length();     // font name
				memcpy(buf+pos, fontName.c_str(), len);
				pos+=len;

				buf[pos++] = 0x0D;   // an Enter
				// �^��c��
				int finalLength=htons((char*)buf+pos-pszPos-2);
				memmove(pszPos,&finalLength,2);
				break;
	}
	return pos;
}
Example #15
0
 DemoController(const ros::NodeHandle& n):nh(n){
   receiver = getReceiver("receiver");
   receiver->enable(TIME_STEP/2);
 }
Example #16
0
int CMCastRecvServer::run()
{
    SocketEndpoint ackEp(broadcastRoot);
    ackEp.port = ackPort;
    StringBuffer s;
    ackEp.getIpText(s);
    ackSock.setown(ISocket::udp_connect(ackEp.port, s.str()));
    ackSock->set_send_buffer_size(UDP_SEND_SIZE);

    StringBuffer ipStr;
    mcastEp.getIpText(ipStr);
    sock.setown(ISocket::multicast_create(mcastEp.port, ipStr.str()));
    sock->set_receive_buffer_size(UDP_RECV_SIZE);
    SocketEndpoint ep(ipStr.str());
    sock->join_multicast_group(ep);

    
    MemoryBuffer mbAck;
    MCAckPacketHeader *ackPacket = (MCAckPacketHeader *)mbAck.reserveTruncate(MC_ACK_PACKET_SIZE);

    ackPacket->node = groupMember;

    LOG(MCdebugProgress(10), unknownJob, "Running as client %d connected to server %s", groupMember, broadcastRoot.get());

    unsigned *nackList = (unsigned *)(((byte *)ackPacket)+sizeof(MCAckPacketHeader));
    const unsigned *nackUpper = (unsigned *)((byte *)ackPacket)+MC_ACK_PACKET_SIZE-sizeof(unsigned);

    Owned<CDataPacket> dataPacket = new CDataPacket();

    CTimeMon logTm(10000), logTmCons(5000), logTmPoll(5000), logTmOld(5000), logTmNoRecv(5000);
    loop
    {
        try
        {
            unsigned startTime = msTick();
            loop
            {
                try
                {
                    size32_t szRead;
                    sock->read(dataPacket->header, sizeof(MCPacketHeader), MC_PACKET_SIZE, szRead, 5000);
                    break;
                }
                catch (IException *e)
                {
                    if (JSOCKERR_timeout_expired != e->errorCode())
                        throw;
                    else e->Release();
                    LOG(MCdebugProgress(1), unknownJob, "Waiting on packet read socket (waited=%d)", msTick()-startTime);
                }
            }
            if (stopped) break;
            if (MCPacket_Stop == dataPacket->header->cmd)
            {
                stopped = true;
                break;
            }
            ackPacket->tag = dataPacket->header->tag;
            ackPacket->jobId = dataPacket->header->jobId;

            if (oldJobIds.find(dataPacket->header->jobId))
            {
                if (MCPacket_Poll == dataPacket->header->cmd)
                {
                    ackPacket->ackDone = true;
                    MilliSleep(MAX_POLL_REPLY_DELAY/(groupMember+1));
                    ackSock->write(ackPacket, sizeof(MCAckPacketHeader));
                }

                if (tracingPeriod && logTmOld.timedout())
                {
                    LOG(MCdebugProgress(1), unknownJob, "Old job polled=%s", MCPacket_Poll == dataPacket->header->cmd?"true":"false");
                    logTmOld.reset(tracingPeriod);
                }
            }
            else
            {
                CMCastReceiver *receiver = getReceiver(dataPacket->header->tag);
                if (receiver)
                {
                    if (MCPacket_Poll == dataPacket->header->cmd)
                    {
                        size32_t sz;
                        bool res = receiver->buildNack(ackPacket, sz, dataPacket->header->total);
                        MilliSleep(MAX_POLL_REPLY_DELAY/(groupMember+1));
                        ackSock->write(ackPacket, sz);
                        if (tracingPeriod && logTmPoll.timedout())
                        {
                            LOG(MCdebugProgress(1), unknownJob, "Send nack back sz=%d, res=%s, done=%s", sz, res?"true":"false", ackPacket->ackDone?"true":"false");
                            logTmPoll.reset(tracingPeriod);
                        }
                    }
                    else
                    {
                        unsigned total = dataPacket->header->total;
                        bool done;
                        if (receiver->packetReceived(*dataPacket, done)) // if true, packet consumed
                        {
                            unsigned level;
                            if (tracingPeriod && logTmCons.timedout())
                            {
                                level = 1;
                                logTmCons.reset(5000);
                            } else level = 110;
                            LOG(MCdebugProgress(level), unknownJob, "Pkt %d taken by receiver", dataPacket->header->id);
                            if (done)
                            {
                                LOG(MCdebugProgress(10), unknownJob, "Client (tag=%x, jobId=%d) received all %d packets", dataPacket->header->tag, dataPacket->header->jobId, dataPacket->header->total);
                                oldJobIds.replace(* new CUIntValue(dataPacket->header->jobId));
                            }
                            // JCSMORE should use packet pool.
                            // init new packet
                            dataPacket.setown(new CDataPacket());
                        }
                        else if (tracingPeriod && logTm.timedout())
                        {
                            LOG(MCdebugProgress(150), unknownJob, "throwing away packet %d", dataPacket->header->id);
                            logTm.reset(tracingPeriod);
                        }

                        if (!done)
                        {
                            size32_t sz;
                            if (receiver->buildNack(ackPacket, sz, total))
                                ackSock->write(ackPacket, sz);
                        }
                    }
                }
                else if (tracingPeriod && logTmNoRecv.timedout())
                {
                    LOG(MCdebugProgress(1), unknownJob, "No Receiver tag=%d", dataPacket->header->tag);
                    logTmNoRecv.reset(tracingPeriod);
                }
            }
        }
        catch (IException *e)
        {
            pexception("Client Exception",e);
            break;
        }
    }

    PROGLOG("Receive server stopping, aborting receivers");
    {
        CriticalBlock b(receiversCrit);
        SuperHashIteratorOf<CMCastReceiver> iter(receivers);
        ForEach (iter)
            iter.query().stop();
    }

    return 0;
}
Example #17
0
static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject* callback, Qt::ConnectionType type)
{
    if (!signal || !PySide::Signal::checkQtSignal(signal))
        return false;
    signal++;

    int signalIndex = PySide::SignalManager::registerMetaMethodGetIndex(source, signal, QMetaMethod::Signal);
    if (signalIndex == -1)
        return false;

    PySide::SignalManager& signalManager = PySide::SignalManager::instance();

    // Extract receiver from callback
    QObject* receiver = 0;
    PyObject* self = 0;
    bool usingGlobalReceiver = getReceiver(source, callback, &receiver, &self);
    if (receiver == 0 && self == 0)
        return false;

    const QMetaObject* metaObject = receiver->metaObject();
    const QByteArray callbackSig = PySide::Signal::getCallbackSignature(signal, receiver, callback, usingGlobalReceiver).toAscii();
    const char* slot = callbackSig.constData();
    int slotIndex = metaObject->indexOfSlot(slot);
    if (slotIndex == -1) {
        if (!usingGlobalReceiver && self && !Shiboken::Object::hasCppWrapper((SbkObject*)self)) {
            qWarning() << "You can't add dynamic slots on an object originated from C++.";
            if (usingGlobalReceiver)
                signalManager.releaseGlobalReceiver(source, receiver);

            return false;
        }

        if (usingGlobalReceiver)
            slotIndex = signalManager.globalReceiverSlotIndex(receiver, slot);
        else
            slotIndex = PySide::SignalManager::registerMetaMethodGetIndex(receiver, slot, QMetaMethod::Slot);

        if (slotIndex == -1) {
            if (usingGlobalReceiver)
                signalManager.releaseGlobalReceiver(source, receiver);

            return false;
        }
    }
    if (QMetaObject::connect(source, signalIndex, receiver, slotIndex, type)) {
        if (usingGlobalReceiver)
            signalManager.notifyGlobalReceiver(receiver);
        #ifndef AVOID_PROTECTED_HACK
            source->connectNotify(signal - 1);
        #else
            // Need to cast to QObjectWrapper* and call the public version of
            // connectNotify when avoiding the protected hack.
            reinterpret_cast<QObjectWrapper*>(source)->connectNotify(signal - 1);
        #endif

        return true;
    }

    if (usingGlobalReceiver)
        signalManager.releaseGlobalReceiver(source, receiver);

    return false;
}