From 7d0af0eb5ba8d98d9cb86f86f6a26b2928e947df Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Fri, 4 Aug 2023 19:47:17 -0600 Subject: [PATCH] Added NewSignal that extensions can process when a node is newly created --- node.go | 4 +++- signal.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/node.go b/node.go index c8dd96f..b8a60f6 100644 --- a/node.go +++ b/node.go @@ -432,7 +432,9 @@ func NewNode(ctx *Context, key *ecdsa.PrivateKey, node_type NodeType, buffer_siz } if queued_signals == nil { - queued_signals = []QueuedSignal{} + queued_signals = []QueuedSignal{ + QueuedSignal{uuid.New(), &NewSignal, time.Now()}, + } } next_signal, timeout_chan := SoonestSignal(queued_signals) diff --git a/signal.go b/signal.go index 902466e..7e1e7b4 100644 --- a/signal.go +++ b/signal.go @@ -17,6 +17,7 @@ import ( type SignalDirection int const ( StopSignalType SignalType = "STOP" + NewSignalType = "NEW" StartSignalType = "START" ErrorSignalType = "ERROR" StatusSignalType = "STATUS" @@ -140,6 +141,7 @@ func NewDirectSignal(signal_type SignalType) BaseSignal { return NewBaseSignal(signal_type, Direct) } +var NewSignal = NewDirectSignal(NewSignalType) var StartSignal = NewDirectSignal(StartSignalType) var StopSignal = NewDownSignal(StopSignalType)