void MamdaMultiSecurityManager::MamdaMultiSecurityManagerImpl::forwardMsg (
        MamdaSubscription*    subscription,
        const MamaMsg&        msg,
        short                 msgType)
    {
        const char* symbol = msg.getString (MamdaCommonFields::ISSUE_SYMBOL);

        if (symbol)
        {
            ListenerListMap::iterator found = mSecurityListeners.find (symbol);

            if (found != mSecurityListeners.end())
            {
                forwardMsg (found->second, 
                            subscription, 
                            msg, 
                            msgType);
            }
            else
            {
                //This allows for new securities coming online intraday
                //which were not in the cache on startup.
                createListenerListAndNotify (subscription, symbol);        
            }
        }
    }
    void MamdaMultiSecurityManager::MamdaMultiSecurityManagerImpl::onMsg (
        MamdaSubscription*  subscription,
        const MamaMsg&      msg,
        short               msgType)
    {
        mama_log (MAMA_LOG_LEVEL_FINEST,
                  "MamdaMultiSecurityManager: got msg type=%d",
                  msgType);

        try
        {
            // First handle the message internally
            switch (msgType)
            {
            case MAMA_MSG_TYPE_INITIAL:
            case MAMA_MSG_TYPE_RECAP:
                handleFullImage (subscription, msg, msgType);
                break;
            case MAMA_MSG_TYPE_END_OF_INITIALS:
                return;
            default:
                break;
            }
            // Now pass to other listeners (if any)
            forwardMsg (subscription, msg, msgType);
        }
        catch (MamdaDataException& e)
        {
            mama_log (MAMA_LOG_LEVEL_FINE,
                      "MamdaMultiSecurityManager: caught MamdaDataException: %s",
                      e.what());
        }
    }
Ejemplo n.º 3
0
	virtual void ArraySend(CkDelegateData *pd,int ep,void *m,const CkArrayIndex &idx,CkArrayID a)
	{
		CkArray *arrMgr=CProxy_CkArray(a).ckLocalBranch();
		int onPE=arrMgr->lastKnown(idx);
		if (onPE==CkMyPe()) 
		{ //Send to local element
			arrMgr->deliver((CkMessage *)m, CkDeliver_queue);
		} else 
		{ //Forward to remote element
			ckout<<"DelegateMgr> Sending message for "<<idx.data()[0]<<" to "<<onPE<<endl;
			envelope *env=UsrToEnv(m);
			CkPackMessage(&env);
			forwardMsg(ep,idx,a,env->getTotalsize(),(char *)env);
			CkFreeMsg(m);
		}
	}
Ejemplo n.º 4
0
void CWFriendManager::OnRemoveBlackList(GameMsg_Base &msg, CSlotPeer & slotPeer)
{
	GameMsg_S2G_RemoveBlackList *pMsg =  (GameMsg_S2G_RemoveBlackList*)&msg;
	if (pMsg != NULL)
	{
		CGroupRoleEntity *pRole = CGroupPlayerManager::Instance().SearchRoleByID(pMsg->m_nSrcRoleID);
		if (pRole != NULL)
		{
			pRole->RemoveBlackList(pMsg->m_nTargetID);
		}
		CGroupRoleEntity *pTargetRole = CGroupPlayerManager::Instance().SearchRoleByID(pMsg->m_nTargetID);
		if (pTargetRole != NULL) {
			pTargetRole->RemoveFriend(pMsg->m_nSrcRoleID);
			GameMsg_G2S_NotifyGameHasBeenDeletedBlacklist forwardMsg(pMsg->m_nSrcRoleID);
			pTargetRole->SendPlayerMsg(&forwardMsg);
		}
	}
}
Ejemplo n.º 5
0
void handleInvokeForwardRequest(RemoteOpHeader *h, Node srv, Stream str)
{
  ConcreteType ct;
  Object o;
  unsigned int answer;

  anticipateGC(64*1024 + 2 * StreamLength(str));
  TRACE(rinvoke, 3, ("InvokeForwardRequest received"));
  TRACE(rinvoke, 6, ("Checking for CT for incoming activation"));
  ct = (ConcreteType) doObjectRequest(srv, &h->targetct, ctct);
  assert(! ISNIL(ct));

  TRACE(rinvoke, 4, ("InvokeForwarded for object with ID %s", OIDString(h->target)));
  o = OIDFetch(h->target);
  assert(!ISNIL(o));
  if (RESDNT(o->flags)) {
    int more;
    State *state;
    TRACE(rinvoke, 4, ("The object is here, accepting activation"));
    ReadInt(&answer, str);
    more = memcmp(ReadStream(str, 4), "ACT!", 4);
    assert(!more);
    /* Suck out an activation record - argh! */
    TRACE(rinvoke, 6, ("Incoming activation record!!"));
    state = extractActivation(o, ct, str, srv);
    if (!ISNIL(answer)) {
#define sp state->sp
      PUSH(u32, answer);
      PUSH(ConcreteType, BuiltinInstCT(BOOLEANI));
    }
#undef sp
  } else {
    Node newsrv = getLocFromObj(o);
    TRACE(rinvoke, 4, ("Forwarding request to %s", NodeString(newsrv)));
    if (forwardMsg(newsrv, h, str) < 0) {
      Stream newstr;
      RewindStream(str);
      newstr = StealStream(str);
      findAndSendTo(h->target, newstr);
    }
  }
  TRACE(rinvoke, 4, ("Invoke forward request done"));
  inhibit_gc--;
}
Ejemplo n.º 6
0
void handleInvokeRequest(RemoteOpHeader *h, Node srv, Stream str)
{
  Stream newstr;
  int argc = h->option2, retc = h->option1, fn = h->status, i;
  Object obj;
  ConcreteType ct = 0;
  RemoteOpHeader replyh;
  int *sp;
  State *state;

  anticipateGC(64 * 1024 + 2 * StreamLength(str));
  TRACE(rinvoke, 3, ("InvokeRequest received"));
  /* figure out who we're invoking on */
  obj = OIDFetch(h->target);

  if (!ISNIL(obj)) {
    ct = CODEPTR(obj->flags);
    TRACE(rinvoke, 4, ("Target is a %.*s, operation name is %.*s[%d]",
		       ct->d.name->d.items, ct->d.name->d.data, 
		       ct->d.opVector->d.data[fn]->d.name->d.items,
		       ct->d.opVector->d.data[fn]->d.name->d.data, argc));
  } else {
    TRACE(rinvoke, 1, ("Invoking %s op %d [%d] -> [%d]", OIDString(h->target),
		       fn, argc, retc));
  }

  if (ISNIL(obj)) {
    /*
     * Invoke came here, but we don't know anything about this object.
     * First find it, then send it the message.
     */
    TRACE(rinvoke, 1, ("Trying to find the object and send it the message"));
    ct = (ConcreteType)doObjectRequest(replyh.sslocation, &h->targetct, ctct);
    obj = createStub(ct, getNodeRecordFromSrv(replyh.sslocation), h->target);

    RewindStream(str);
    newstr = StealStream(str);
    findAndSendTo(h->target, newstr);
  } else if (!RESDNT(obj->flags)) {
    Node newsrv = getLocFromObj(obj);
    /* Invoke came here, but the object is elsewhere */
    /* First check to see if we think the object is where this invoke
       came from */
    if (SameNode(srv, newsrv) || SameNode(myid, newsrv) || SameNode(limbo, newsrv)) {
      TRACE(rinvoke, 1, ("Have stub, but points back.  Forwarding to limbo"));
      RewindStream(str);
      newstr = StealStream(str);
      findAndSendTo(h->target, newstr);
    } else {
      TRACE(rinvoke, 1, ("Forwarding invoke to %s", NodeString(newsrv)));
      if (forwardMsg(newsrv, h, str) < 0) {
	RewindStream(str);
	newstr = StealStream(str);
	findAndSendTo(h->target, newstr);
      }
    }
  } else if (fakeUnavailable && ((random() % 100) < fakeUnavailable)) {
    newstr = StealStream(str);
    sendUnavailableReply(newstr);
  } else {
    OID oid;
    state = newState(obj, ct);
    OIDRemoveAny((Object)state);
    ReadOID(&oid, str);
    OIDInsert(oid, (Object) state);
    for (sp = (int *)state->sb, i = 0 ; i < 2 * retc ; i++) *sp++ = JNIL;
    extractNVars(str, argc, sp, &state->ep, &state->et, srv);
    sp += argc * 2;
    TRACE(rinvoke, 4, ("Doing upcall on a %.*s",
		       CODEPTR(obj->flags)->d.name->d.items, 
		       CODEPTR(obj->flags)->d.name->d.data));
    state->sp = (u32)sp;
    pushBottomAR(state);

    /* set up the interpreter state */
    state->pc = (u32) ct->d.opVector->d.data[fn]->d.code->d.data;
    dependsOn(state, stateFetch(h->ss, h->sslocation), retc);
    makeReady(state);
  }
  inhibit_gc--;
}