WIP
This commit is contained in:
@@ -36,6 +36,9 @@ var multicastAddr = net.UDPAddrFromAddrPort(netip.AddrPortFrom(
|
||||
type Globals struct {
|
||||
LocalConfig // Embed, immutable.
|
||||
|
||||
// The number of startups
|
||||
StartupCount uint16
|
||||
|
||||
// Local public address (if available). Immutable.
|
||||
LocalAddr netip.AddrPort
|
||||
|
||||
@@ -63,11 +66,13 @@ type Globals struct {
|
||||
|
||||
func NewGlobals(
|
||||
localConfig LocalConfig,
|
||||
startupCount startupCount,
|
||||
localAddr netip.AddrPort,
|
||||
conn *net.UDPConn,
|
||||
iface io.ReadWriteCloser,
|
||||
) (g Globals) {
|
||||
g.LocalConfig = localConfig
|
||||
g.StartupCount = startupCount.Count
|
||||
|
||||
g.LocalAddr = localAddr
|
||||
g.LocalAddrValid = localAddr.IsValid()
|
||||
@@ -87,8 +92,7 @@ func NewGlobals(
|
||||
|
||||
g.IFace = iface
|
||||
|
||||
// TODO: Initialize w/ startup count.
|
||||
traceID := uint64(time.Now().Unix()<<30) + 1
|
||||
traceID := (uint64(g.StartupCount) << 48) + 1
|
||||
g.NewTraceID = func() uint64 {
|
||||
return atomic.AddUint64(&traceID, 1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user