public void HandleServerTick(SuperPacketReader reader, SuperPacket <PQ> superpacket) { // Update sizes recvKbpsEstimateAcc += reader.size(); lastRecvSize += reader.size(); perTickSize.AddOrUpdate(reader.tickId(), reader.size(), (key, old) => old + reader.size()); // Check handshake status if (!superpacket.HasFlag(SuperPacketFlags.Handshake)) { LastServerId = Overflow.max(LastServerId, reader.tickId()); // TODO(gpascualg): Make phase sync id diff optional int idDiff = Overflow.signed_diff(phaseSync.TickId, LastServerId); ServerTimeDiff = idDiff - (estimatedRTT / 50.0f + 1); //- (int)(estimatedRTT / 2.0f); } else { // Fix phase sync, otherwise we will get a huge spike LastServerId = reader.tickId(); if (serverBasedSync) { phaseSync.FixTickId(LastServerId); } } // Update PLL phaseSync.ServerPacket(reader.tickId(), LastServerId); }
private void onReceivedImpl(ushort tickId, SuperPacketReader reader) { if (DropRecv()) { return; } if (protocol.IsOutOfOrder(reader.tickId()) && !reader.HasFlag(SuperPacketFlags.Handshake)) { return; } // Add to pending list pendingPackets.Add(reader); lastPacketID = reader.id(); lastPacketSize = reader.size(); // Handle all acks already protocol.HandleAcks(tickId, reader, superPacket, marshal); }