Fix bug: faststart and fastping not working

This commit is contained in:
Kusakabe Si 2021-12-12 18:32:30 +00:00
parent 350a7e43f6
commit 2a27f7b463
3 changed files with 9 additions and 2 deletions

View File

@ -383,7 +383,11 @@ func NewDevice(tapDevice tap.Device, id mtypes.Vertex, bind conn.Bind, logger *L
go device.RoutineClearL2FIB()
go device.RoutineRecalculateNhTable()
go device.RoutinePostPeerInfo(device.Chan_HttpPostStart)
go func() {
<-device.Chan_Supernode_OK
device.Chan_SendRegisterStart <- struct{}{}
}()
}
// create queues

View File

@ -134,7 +134,7 @@ func (et *endpoint_trylist) GetNextTry() (bool, string) {
return false, ""
}
smallest.lastTry = time.Now()
if smallest.firstTry.After(time.Time{}) {
if !smallest.firstTry.After(time.Time{}) {
smallest.firstTry = time.Now()
}
if smallest.firstTry.Add(et.timeout).Before(time.Now()) {

View File

@ -771,6 +771,9 @@ func (device *Device) RoutineSetEndpoint() {
}
if FastTry {
NextRun = true
if device.LogLevel.LogControl {
fmt.Printf("Control: First try for peer %v at endpoint %v, sending hole-punching ping\n", thepeer.ID.ToString(), connurl)
}
go device.SendPing(thepeer, int(device.EdgeConfig.DynamicRoute.ConnNextTry+1), 1, 1)
}