public void OnMsg(NotCachedMsg msg) { lock (this.SyncRoot) recvCount++; DoAction(this, msg); }
public void LogicalQueryViaUdpBroadcast_Broadcast_Query() { // Verify that a query with the broadcast flag set is actually // delivered to multiple service instances and that the response // from one of them is received. _LeafRouter leaf0 = null; _LeafRouter leaf1 = null; _LeafRouter leaf2 = null; Msg query; TestAck ack; string s; Msg.LoadTypes(Assembly.GetExecutingAssembly()); try { leaf0 = CreateLeaf("detached", "hub0", "leaf0", group); leaf1 = CreateLeaf("detached", "hub0", "leaf1", group); leaf2 = CreateLeaf("detached", "hub0", "leaf2", group); Thread.Sleep(InitDelay); s = "Hello World!"; query = new NotCachedMsg("Normal", s); query._Flags |= MsgFlag.Broadcast; ack = (TestAck)leaf0.Query("logical://leaf", query); Assert.AreEqual(s, ack.Value); Thread.Sleep(1000); Assert.AreEqual(1, leaf0.ReceiveCount); Assert.AreEqual(1, leaf1.ReceiveCount); Assert.AreEqual(1, leaf2.ReceiveCount); } finally { if (leaf0 != null) { leaf0.Stop(); } if (leaf1 != null) { leaf1.Stop(); } if (leaf2 != null) { leaf2.Stop(); } Config.SetConfig(null); } }