public void handleCommand(ICommunicationMessage message) { long clientid = 0, immediateid = 0; try { clientid = Convert.ToInt64(message.GetValue("ClientID").ToString()); lock (m_ClientCommunicators) { if (!m_ClientCommunicators.ContainsKey(clientid)) { return; // 非来自自身管理的client的响应包, 不处理 } } } catch { return; // 没有clientid的报文不处理 } try { // 非自身发包的响应以及向客户端的主动发包都发送到客户端 if (message.Contains(Constants.MSG_PARANAME_IMMEDIATE_ID)) { immediateid = Convert.ToInt64(message.GetValue(Constants.MSG_PARANAME_IMMEDIATE_ID).ToString()); } if (clientid == Constants.BOARDCAST_CLIENT_ID) { lock (m_ClientCommunicators) { foreach (Communicator disp in m_ClientCommunicators.Values) { disp.enqueueMessage(message.clone()); } } } else { ICommunicator dispatcher = null; lock (m_ClientCommunicators) { if (!m_ClientCommunicators.ContainsKey(clientid)) { return; } dispatcher = m_ClientCommunicators[clientid]; } dispatcher.enqueueMessage(message); } } catch (Exception ex) { SendLog(ex.ToString()); } finally { } }