protected void HandleReader(P2PNetworkReader reader, int received_size, int channel_id) { while ((ulong)reader.Position < (ulong)((long)received_size)) { ushort num = reader.ReadUInt16(); short num2 = reader.ReadInt16(); uint position = reader.Position; reader.SetGuard(position + (uint)num); P2PConnection.s_Size = position + (uint)num; if (this.m_LogNetworkMessages) { Debug.Log(string.Concat(new object[] { "ConnectionRecv con:", this.m_ConnectionId, " bytes:", num, " msgId:", num2 })); } List <P2PNetworkMessageDelegate> list = null; if (this.m_MessageHandlersDict.ContainsKey(num2)) { list = this.m_MessageHandlersDict[num2]; } if (list != null) { this.m_NetMsg.m_MsgType = num2; this.m_NetMsg.m_Reader = reader; this.m_NetMsg.m_Connection = this; this.m_NetMsg.m_ChannelId = channel_id; for (int i = 0; i < list.Count; i++) { list[i](this.m_NetMsg); } this.m_LastMessageTime = Time.time; } else if (P2PLogFilter.logError) { Debug.LogError(string.Format("Unknown message type {0} connection id: {1}", P2PMsgType.MsgTypeToString(num2), this.m_ConnectionId)); } if (position + (uint)num != reader.Position) { int num3 = (int)(position + (uint)num - reader.Position); if (num3 > 0 && P2PLogFilter.logInfo) { Debug.Log(string.Format("Message {0} conn_id: {1} was not fully read, performing seek by {2} bytes", P2PMsgType.MsgTypeToString(num2), this.m_ConnectionId, num3)); } if (num3 < 0 && P2PLogFilter.logError) { Debug.LogError(string.Format("Message {0} conn_id: {1} reading over the buffer limit (this is really bad), performing seek by {2} bytes", P2PMsgType.MsgTypeToString(num2), this.m_ConnectionId, num3)); } reader.Seek(num3); } reader.RemoveGuard(); } }