mirror of
https://codeberg.org/demostf/parser.git
synced 2026-10-01 08:44:05 +02:00
fix "trace" feature breaking parsing the stop tick
This commit is contained in:
parent
6cfd4990a6
commit
b9f483d4d0
1 changed files with 8 additions and 3 deletions
|
|
@ -16,7 +16,7 @@ use crate::demo::data::DemoTick;
|
||||||
use crate::demo::parser::Encode;
|
use crate::demo::parser::Encode;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "trace")]
|
#[cfg(feature = "trace")]
|
||||||
use tracing::{event, span, Level};
|
use tracing::{Level, event, span};
|
||||||
|
|
||||||
pub mod consolecmd;
|
pub mod consolecmd;
|
||||||
pub mod datatable;
|
pub mod datatable;
|
||||||
|
|
@ -105,8 +105,13 @@ impl<'a> Parse<'a> for Packet<'a> {
|
||||||
let packet_type = PacketType::read(stream)?;
|
let packet_type = PacketType::read(stream)?;
|
||||||
#[cfg(feature = "trace")]
|
#[cfg(feature = "trace")]
|
||||||
{
|
{
|
||||||
let tick: u32 = stream.read()?;
|
let tick: u32 = if packet_type == PacketType::Stop {
|
||||||
stream.set_pos(stream.pos() - 32)?;
|
0
|
||||||
|
} else {
|
||||||
|
let tick = stream.read()?;
|
||||||
|
stream.set_pos(stream.pos() - 32)?;
|
||||||
|
tick
|
||||||
|
};
|
||||||
let _span =
|
let _span =
|
||||||
span!(Level::INFO, "reading packet", packet_type = ?packet_type, tick = tick)
|
span!(Level::INFO, "reading packet", packet_type = ?packet_type, tick = tick)
|
||||||
.entered();
|
.entered();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue