public void OnMsg(CachedMsg msg) { lock (this.SyncRoot) recvCount++; DoAction(this, msg); }
public void PhysicalQuery_Cached_Remote() { _HubRouter hub = null; _LeafRouter leaf = null; CachedMsg query; TestAck ack1; TestAck ack2; Msg.LoadTypes(Assembly.GetExecutingAssembly()); try { hub = CreateHub("detached", "hub0", group); leaf = CreateLeaf("detached", "hub0", "leaf0", group); Thread.Sleep(InitDelay); // Verify that sessions and replies are cached query = new CachedMsg("ActionCount", string.Empty); ack1 = (TestAck)leaf.Query(hub.RouterEP, query); Assert.AreEqual(1, hub.ReceiveCount); // Simulate the resending of the query message and wait // for another reply. The second reply should hold the // same value as the first. query = new CachedMsg("ActionCount", string.Empty); query._ToEP = leaf.RouterEP; query._SessionID = ack1._SessionID; query._Flags |= MsgFlag.OpenSession | MsgFlag.ServerSession | MsgFlag.KeepSessionID; ack2 = (TestAck)leaf.Query(hub.RouterEP, query); Assert.AreEqual(1, hub.ReceiveCount); Assert.AreEqual(ack1.Value, ack2.Value); } finally { if (hub != null) { hub.Stop(); } if (leaf != null) { leaf.Stop(); } Config.SetConfig(null); } }