Example #1
0
void 
Trix::execREAD_CONFIG_REQ(Signal* signal)
{
  jamEntry();

  const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr();

  Uint32 ref = req->senderRef;
  Uint32 senderData = req->senderData;

  const ndb_mgm_configuration_iterator * p = 
    m_ctx.m_config.getOwnConfigIterator();
  ndbrequire(p != 0);

  // Allocate pool sizes
  c_theAttrOrderBufferPool.setSize(100);
  c_theSubscriptionRecPool.setSize(100);

  DLList<SubscriptionRecord> subscriptions(c_theSubscriptionRecPool);
  SubscriptionRecPtr subptr;
  while(subscriptions.seize(subptr) == true) {
    new (subptr.p) SubscriptionRecord(c_theAttrOrderBufferPool);
  }
  subscriptions.release();

  ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
  conf->senderRef = reference();
  conf->senderData = senderData;
  sendSignal(ref, GSN_READ_CONFIG_CONF, signal, 
	     ReadConfigConf::SignalLength, JBB);
}
Example #2
0
				void removeListener(const Client::listener_token_type& h)
				{
					std::remove(mHandlers.begin(), mHandlers.end(), h);
					auto heads = subscriptions();
					if (heads.find(h->head()) == heads.end()) {
						if (mClient.IsOpen())
							mClient.Unsubscribe(h->head().c_str());
					}
				}
Example #3
0
				Client::listener_token_type setListener(const shared_ptr<detail::Handler>& h)
				{
					auto heads = subscriptions();
					mHandlers.push_back(h);
					if (heads.find(h->head()) == heads.end()) {
						if (mClient.IsOpen())
							mClient.Subscribe(h->head().c_str());
					}
					return h;
				}
Example #4
0
        void  disconnect()
        {
          if (!mClient.IsOpen()) return;

          send("vrProcEnd", model().componentID());

          for (const auto& s : subscriptions()) {
            mClient.Unsubscribe(s.c_str());
          }

          mClient.CloseConnection();
        }
Example #5
0
        OptionalError connect()
        {
          if (mClient.IsOpen()) return Error::NO_ERROR;

          mClient.SetScope(model().scope().c_str());

          if (!mClient.OpenConnection(model().host().c_str(),
                model().port().c_str())) {

            return Error("Failed to connect to VHMsg server."
                        , "Please check that the server is running at " +
              model().host() + ":" + model().port());
          }

          mClient.SetListener(this);

          for (const auto& s : subscriptions()) {
            mClient.Subscribe(s.c_str());
          }

          send("vrComponent", model().componentID());

          return Error::NO_ERROR;
        }
Example #6
0
 ~SubAdBlockManager() {
     QList<AdBlockSubscription*> list = subscriptions();
     foreach (AdBlockSubscription *s, list)
         removeSubscription(s);
     setEnabled(false);
 }