Skip to content

Commit

Permalink
Remove evaluated Cstruct.hexdump_pp on guards which slow down our pro…
Browse files Browse the repository at this point in the history
…cess (#209)

* Remove evaluated Cstruct.hexdump_pp on guards which slow down our process
  • Loading branch information
dinosaure committed Jan 24, 2024
1 parent 22d0104 commit 10387eb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/engine.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1266,8 +1266,8 @@ let incoming_data ?(add_timestamp = false) err (ctx : keys) hmac_algorithm
let* () =
guard
(Cstruct.length dec >= hdr_len)
(Result.msgf "payload too short (need %d bytes): %a" hdr_len
Cstruct.hexdump_pp dec)
(Result.msgf "payload too short (need %u bytes): %u" hdr_len
(Cstruct.length dec))
in
(* TODO validate replay packet id and ordering *)
Log.debug (fun m ->
Expand All @@ -1279,8 +1279,8 @@ let incoming_data ?(add_timestamp = false) err (ctx : keys) hmac_algorithm
let* () =
guard
(Cstruct.length data >= Packet.id_len + tag_len)
(Result.msgf "payload too short (need %d bytes): %a"
(Packet.id_len + tag_len) Cstruct.hexdump_pp data)
(Result.msgf "payload too short (need %u bytes): %u"
(Packet.id_len + tag_len) (Cstruct.length data))
in
let replay_id, tag, payload =
let sn, rest = Cstruct.split data Packet.id_len in
Expand All @@ -1302,8 +1302,8 @@ let incoming_data ?(add_timestamp = false) err (ctx : keys) hmac_algorithm
let* () =
guard
(Cstruct.length data >= Packet.id_len + tag_len)
(Result.msgf "payload too short (need %d bytes): %a"
(Packet.id_len + tag_len) Cstruct.hexdump_pp data)
(Result.msgf "payload too short (need %u bytes): %u"
(Packet.id_len + tag_len) (Cstruct.length data))
in
let replay_id, tag, payload =
let sn, rest = Cstruct.split data Packet.id_len in
Expand Down

0 comments on commit 10387eb

Please sign in to comment.