WIP: Cleanup
This commit is contained in:
@@ -9,6 +9,11 @@ import (
|
||||
|
||||
type stateFunc func(msg any) stateFunc
|
||||
|
||||
type sentProbe struct {
|
||||
SentAt time.Time
|
||||
Addr netip.AddrPort
|
||||
}
|
||||
|
||||
type remoteFSM struct {
|
||||
*Remote
|
||||
|
||||
@@ -196,7 +201,7 @@ func (r *remoteFSM) stateServer_onSyn(msg controlMsg[packetSyn]) {
|
||||
break
|
||||
}
|
||||
r.logf("Probing %v...", addr)
|
||||
r.sendControlToAddr(packetProbe{TraceID: newTraceID()}.Marshal(r.buf), addr)
|
||||
r.sendControlToAddr(packetProbe{TraceID: r.NewTraceID()}.Marshal(r.buf), addr)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +269,7 @@ func (r *remoteFSM) stateClientInit(iMsg any) stateFunc {
|
||||
|
||||
func (r *remoteFSM) stateClientInit_sendInit() {
|
||||
conf := r.conf()
|
||||
r.traceID = newTraceID()
|
||||
r.traceID = r.NewTraceID()
|
||||
init := packetInit{
|
||||
TraceID: r.traceID,
|
||||
Direct: conf.Direct,
|
||||
@@ -311,7 +316,7 @@ func (r *remoteFSM) enterClient() stateFunc {
|
||||
conf := r.conf()
|
||||
r.probes = make(map[uint64]sentProbe, 8)
|
||||
|
||||
r.traceID = newTraceID()
|
||||
r.traceID = r.NewTraceID()
|
||||
r.stateClient_sendSyn(conf)
|
||||
|
||||
r.pingTimer.Reset(pingInterval)
|
||||
@@ -377,7 +382,7 @@ func (r *remoteFSM) stateClient_cleanProbes() {
|
||||
}
|
||||
|
||||
func (r *remoteFSM) stateClient_sendProbeTo(addr netip.AddrPort) {
|
||||
probe := packetProbe{TraceID: newTraceID()}
|
||||
probe := packetProbe{TraceID: r.NewTraceID()}
|
||||
r.probes[probe.TraceID] = sentProbe{
|
||||
SentAt: time.Now(),
|
||||
Addr: addr,
|
||||
@@ -403,7 +408,7 @@ func (r *remoteFSM) stateClient_onProbe(msg controlMsg[packetProbe]) {
|
||||
conf.DirectAddr = sent.Addr
|
||||
r.updateConf(conf)
|
||||
|
||||
r.traceID = newTraceID()
|
||||
r.traceID = r.NewTraceID()
|
||||
r.stateClient_sendSyn(conf)
|
||||
r.logf("Successful probe to %v.", sent.Addr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user