From d48b6ba08f9fe86f7a42c4ceeed25a7266068ab7 Mon Sep 17 00:00:00 2001 From: Ben-PH Date: Mon, 16 Jun 2025 17:35:19 +0200 Subject: [PATCH] add: Increase the detail of timing info --- main.nim | 2 +- mix/mix_protocol.nim | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/main.nim b/main.nim index 80b8f63..de0078b 100644 --- a/main.nim +++ b/main.nim @@ -256,7 +256,7 @@ proc main() {.async.} = msgId = uint64.fromBytesLE(data[8 ..< 16]) info "Handler", - tm = times.format(time, "mm:ss.fff") + nw = times.format(getTime(), "mm:ss.ffffff"), tm=times.format(time, "mm:ss.ffffff") proc messageValidator( topic: string, msg: Message diff --git a/mix/mix_protocol.nim b/mix/mix_protocol.nim index 650eb81..fc7e868 100644 --- a/mix/mix_protocol.nim +++ b/mix/mix_protocol.nim @@ -1,9 +1,3 @@ -# A node in a swarm. for a 5 node swarm, with just the one publisher (using nushell): -#[ -nim c main.nim -rm -rf infos -^bash -c 'for i in {0..4}; do alacritty -e bash -c "./main $i 5 20 50 1 4; echo Done. Press enter to close...; read" & done' -]# import chronicles, chronos, sequtils, strutils, os import std/[strformat, sysrand] import stew/endians2 @@ -135,6 +129,11 @@ proc handleMixNodeConnection( message[5..<13] = now_ref_thing let exitConn = MixExitConnection.new(message) trace "# Received: ", receiver = multiAddr, message = message + info "Exit", + tm = times.format(now, "mm:ss.ffffff"), + fm = fromPeerID[fromPeerId.len - 2 ..< fromPeerId.len], + me = myPeerId[myPeerId.len - 2 ..< myPeerId.len], + to = "XX" await mixProto.pHandler(exitConn, protocol) if exitConn != nil: @@ -144,11 +143,6 @@ proc handleMixNodeConnection( error "Failed to close exit connection: ", err = e.msg - info "Exit", - tm = times.format(now, "mm:ss.fff"), - fm = fromPeerID[fromPeerId.len - 2 ..< fromPeerId.len], - me = myPeerId[myPeerId.len - 2 ..< myPeerId.len], - to = "XX" of Success: # Add delay let delayMillis = (delay[0].int shl 8) or delay[1].int @@ -184,7 +178,7 @@ proc handleMixNodeConnection( toPeerID = shortLog(peerId) info "Intermediate", - tm = times.format(startTime, "mm:ss.fff"), + tm = times.format(startTime, "mm:ss.ffffff"), fm = fromPeerID[fromPeerId.len - 2 ..< fromPeerId.len], me = myPeerId[myPeerId.len - 2 ..< myPeerId.len], to = toPeerID[toPeerID.len - 2 ..< toPeerID.len] @@ -315,7 +309,7 @@ proc anonymizeLocalProtocolSend*( endTime = getTime() info "Sender", - tm = times.format(startTime, "mm:ss.fff"), + tm = times.format(startTime, "mm:ss.ffffff"), frm = "XX", me = myPeerId[myPeerId.len - 2 ..< myPeerId.len], to = toPeerID[toPeerID.len - 2 ..< toPeerID.len]