WIP: Cleanup
This commit is contained in:
@@ -31,10 +31,6 @@ var multicastAddr = net.UDPAddrFromAddrPort(netip.AddrPortFrom(
|
||||
netip.AddrFrom4([4]byte{224, 0, 0, 157}),
|
||||
4560))
|
||||
|
||||
type marshaller interface {
|
||||
Marshal([]byte) []byte
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
type Globals struct {
|
||||
@@ -62,6 +58,7 @@ type Globals struct {
|
||||
IFace io.ReadWriteCloser
|
||||
|
||||
// For trace ID.
|
||||
NewTraceID func() uint64
|
||||
}
|
||||
|
||||
func NewGlobals(
|
||||
@@ -90,6 +87,12 @@ func NewGlobals(
|
||||
|
||||
g.IFace = iface
|
||||
|
||||
// TODO: Initialize w/ startup count.
|
||||
traceID := uint64(time.Now().Unix()<<30) + 1
|
||||
g.NewTraceID = func() uint64 {
|
||||
return atomic.AddUint64(&traceID, 1)
|
||||
}
|
||||
|
||||
for i := range g.RemotePeers {
|
||||
g.RemotePeers[i] = &atomic.Pointer[Remote]{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user