private bool ProcessPacket() { lock (m_HeartBeatState) { } try { Packet packet = m_NetworkChannelHelper.DeserializePacket(m_ReceiveState.PacketHeader, m_ReceiveState.Stream); m_EventPool.Fire(this, packet); } }
private bool ProcessPacket() { lock (m_HeartBeatState) { m_HeartBeatState.Reset(m_ResetHeartBeatElapseSecondsWhenReceivePacket); } try { object customErrorData = null; Packet packet = m_NetworkChannelHelper.DeserializePacket(m_ReceiveState.Stream, out customErrorData); if (customErrorData != null) { if (NetworkChannelCustomError != null) { NetworkChannelCustomError(this, customErrorData); } } if (packet != null) { m_EventPool.Fire(this, packet); } m_ReceiveState.PrepareForPacketHeader(m_NetworkChannelHelper.PacketHeaderLength); } catch (System.Exception exception) { m_Active = false; if (NetworkChannelError != null) { NetworkChannelError(this, NetworkErrorCode.DeserializePacketError, exception.ToString()); return(false); } throw; } return(true); }
protected virtual bool ProcessPacket() { lock (m_HeartBeatState) { m_HeartBeatState.Reset(m_ResetHeartBeatElapseSecondsWhenReceivePacket); } try { object customErrorData = null; Packet packet = m_NetworkChannelHelper.DeserializePacket(m_ReceiveState.PacketHeader, m_ReceiveState.Stream, out customErrorData); if (customErrorData != null && NetworkChannelCustomError != null) { NetworkChannelCustomError(this, customErrorData); } if (packet != null) { m_ReceivePacketPool.Raise(this, packet); } m_ReceiveState.PrepareForPacketHeader(m_NetworkChannelHelper.PacketHeaderLength); } catch (Exception exception) { m_Active = false; if (NetworkChannelError != null) { SocketException socketException = exception as SocketException; NetworkChannelError(this, NetworkErrorCode.DeserializePacketError, socketException != null ? socketException.SocketErrorCode : SocketError.Success, exception.ToString()); return(false); } throw; } return(true); }