private void OnMessage(uint seq, int source_handle, int dest_handle, IntPtr data, int len) { try { if (IsUnknownServer(source_handle)) { StringBuilder sb = new StringBuilder(256); if (CenterClientApi.TargetName(source_handle, sb, 256)) { string name = sb.ToString(); if (name.StartsWith("NodeJs")) { m_NodeHandles.Add(source_handle); } else if (name.StartsWith("RoomSvr")) { m_RoomSvrHandles.Add(source_handle); } } } byte[] bytes = new byte[len]; Marshal.Copy(data, bytes, 0, len); if (IsNode(source_handle)) { if (!GlobalVariables.Instance.IsWaitQuit) { JsonMessageDispatcher.HandleDcoreMessage(seq, source_handle, dest_handle, bytes); } } else if (IsRoomServer(source_handle)) { m_RoomSvrChannel.Dispatch(source_handle, seq, bytes); } else if (IsBridge(source_handle)) { m_BridgeChannel.Dispatch(source_handle, seq, bytes); } else if (IsStore(source_handle)) { m_StoreChannel.Dispatch(source_handle, seq, bytes); } else if (IsGmServer(source_handle)) { m_GmSvrChannel.Dispatch(source_handle, seq, bytes); } } catch (Exception ex) { LogSys.Log(LOG_TYPE.ERROR, "Exception {0}\n{1}", ex.Message, ex.StackTrace); } }
private void OnMessage(uint seq, int source_handle, int dest_handle, IntPtr data, int len) { try { if (IsUnknownServer(source_handle)) { StringBuilder sb = new StringBuilder(256); if (CenterClientApi.TargetName(source_handle, sb, 256)) { string name = sb.ToString(); if (name.StartsWith("NodeJs")) { m_NodeHandles.Add(source_handle); } else if (name.StartsWith("RoomSvr")) { m_RoomSvrHandles.Add(source_handle); } else if (name.StartsWith("UserSvr")) { m_UserHandles.Add(source_handle); } } } byte[] bytes = new byte[len]; Marshal.Copy(data, bytes, 0, len); if (IsNode(source_handle)) { if (!m_WaitQuit) { m_UserProcessScheduler.DispatchJsonMessage(seq, source_handle, dest_handle, bytes); } } else if (IsUserServer(source_handle)) { DispatchUserMessage(source_handle, seq, bytes); } else if (IsRoomServer(source_handle)) { m_RoomProcessThread.QueueAction(m_RoomSvrChannel.Dispatch, source_handle, seq, bytes); } } catch (Exception ex) { LogSys.Log(LOG_TYPE.ERROR, "Exception {0}\n{1}", ex.Message, ex.StackTrace); } }