private void RpcReceiveReply(WireProtocol.IncomingMessage msg, WireProtocol.Commands.Debugging_Messaging_Reply reply) { WireProtocol.Commands.Debugging_Messaging_Address addr = reply.m_addr; EndPointRegistration eep; eep = RpcFind(addr.m_from_Type, addr.m_from_Id, false); WireProtocol.Commands.Debugging_Messaging_Reply.Reply res = new WireProtocol.Commands.Debugging_Messaging_Reply.Reply(); res.m_found = (eep != null) ? 1u : 0u; res.m_addr = addr; msg.Reply(CreateConverter(), WireProtocol.Flags.c_NonCritical, res); if (eep != null) { lock (eep.m_req_Outbound.SyncRoot) { foreach (EndPointRegistration.OutboundRequest or in eep.m_req_Outbound) { if (or.Seq == addr.m_seq && or.Type == addr.m_to_Type && or.Id == addr.m_to_Id) { or.Reply = reply.m_data; break; } } } } }
private void RpcReceiveQuery(WireProtocol.IncomingMessage msg, WireProtocol.Commands.Debugging_Messaging_Query query) { WireProtocol.Commands.Debugging_Messaging_Address addr = query.m_addr; EndPointRegistration eep = RpcFind(addr.m_to_Type, addr.m_to_Id, true); WireProtocol.Commands.Debugging_Messaging_Query.Reply res = new WireProtocol.Commands.Debugging_Messaging_Query.Reply(); res.m_found = (eep != null) ? 1u : 0u; res.m_addr = addr; msg.Reply(CreateConverter(), WireProtocol.Flags.c_NonCritical, res); }
private void RpcReceiveSend(WireProtocol.IncomingMessage msg, WireProtocol.Commands.Debugging_Messaging_Send send) { WireProtocol.Commands.Debugging_Messaging_Address addr = send.m_addr; EndPointRegistration eep; eep = RpcFind(addr.m_to_Type, addr.m_to_Id, true); WireProtocol.Commands.Debugging_Messaging_Send.Reply res = new WireProtocol.Commands.Debugging_Messaging_Send.Reply(); res.m_found = (eep != null) ? 1u : 0u; res.m_addr = addr; msg.Reply(CreateConverter(), WireProtocol.Flags.c_NonCritical, res); if (eep != null) { Message msgNew = new Message(eep.m_ep, addr, send.m_data); EndPointRegistration.InboundRequest ir = new EndPointRegistration.InboundRequest(eep, msgNew); ThreadPool.QueueUserWorkItem(new WaitCallback(RpcReceiveSendDispatch), ir); } }
bool WireProtocol.IControllerHostLocal.ProcessMessage(WireProtocol.IncomingMessage msg, bool fReply) { msg.Payload = WireProtocol.Commands.ResolveCommandToPayload(msg.Header.m_cmd, fReply, m_capabilities); if (fReply == true) { Request reply = null; lock (m_requests.SyncRoot) { foreach (Request req in m_requests) { if (req.MatchesReply(msg)) { m_requests.Remove(req); reply = req; break; } } } if (reply != null) { reply.Signal(msg); return true; } } else { WireProtocol.Packet bp = msg.Header; switch (bp.m_cmd) { case WireProtocol.Commands.c_Monitor_Ping: { WireProtocol.Commands.Monitor_Ping.Reply cmdReply = new Microsoft.SPOT.Debugger.WireProtocol.Commands.Monitor_Ping.Reply(); cmdReply.m_source = WireProtocol.Commands.Monitor_Ping.c_Ping_Source_Host; cmdReply.m_dbg_flags = (m_stopDebuggerOnConnect ? WireProtocol.Commands.Monitor_Ping.c_Ping_DbgFlag_Stop : 0); msg.Reply(CreateConverter(), WireProtocol.Flags.c_NonCritical, cmdReply); m_evtPing.Set(); return true; } case WireProtocol.Commands.c_Monitor_Message: { WireProtocol.Commands.Monitor_Message payload = msg.Payload as WireProtocol.Commands.Monitor_Message; Debug.Assert(payload != null); if (payload != null) { QueueNotify(m_eventMessage, msg, payload.ToString()); } return true; } case WireProtocol.Commands.c_Debugging_Messaging_Query: case WireProtocol.Commands.c_Debugging_Messaging_Reply: case WireProtocol.Commands.c_Debugging_Messaging_Send: { Debug.Assert(msg.Payload != null); if (msg.Payload != null) { QueueRpc(msg); } return true; } } } if (m_eventCommand != null) { QueueNotify(m_eventCommand, msg, fReply); return true; } return false; }