From ba168535df01c983488533386e572ba0996523ec Mon Sep 17 00:00:00 2001 From: Eugene Medvedev Date: Sun, 26 Oct 2025 14:07:18 +0300 Subject: [PATCH] NNCP_PACKET and NNCP_ORIGIN --- src/node.go | 1 + src/toss.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/node.go b/src/node.go index 14ceda2..fc67390 100644 --- a/src/node.go +++ b/src/node.go @@ -57,6 +57,7 @@ type Node struct { OnlineDeadline time.Duration MaxOnlineTime time.Duration Calls []*Call + Origin *NodeId Busy bool sync.Mutex diff --git a/src/toss.go b/src/toss.go index 4d3ceec..e71496c 100644 --- a/src/toss.go +++ b/src/toss.go @@ -185,10 +185,16 @@ func jobProcess( } if !opts.DryRun { cmd := exec.Command(cmdline[0], append(cmdline[1:], args...)...) + origin := sender.Id.String() + if sender.Origin != nil { + origin = sender.Origin.String() + } cmd.Env = append( cmd.Env, "NNCP_SELF="+ctx.Self.Id.String(), "NNCP_SENDER="+sender.Id.String(), + "NNCP_PACKET="+pktName, + "NNCP_ORIGIN="+origin, "NNCP_NICE="+strconv.Itoa(int(pkt.Nice)), ) if pkt.Type == PktTypeExec { @@ -903,6 +909,7 @@ func jobProcess( Name: area.Name, Incoming: area.Incoming, Exec: area.Exec, + Origin: pktEnc.Sender, } copy(areaNode.Id[:], area.Id[:]) pktName := fmt.Sprintf( -- 2.52.0