mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2025-08-17 08:31:04 +02:00
45-use-statistical-testing
Keepalive is based on per mesh and not per node. Using total ordering mechanism similar to paxos to elect a leader if leader doesn't update it's timestamp within 3 * keepAlive then give the leader a gravestone and elect the next leader. Leader is bassed on lexicographically ordered public key.
This commit is contained in:
@ -13,6 +13,7 @@ import (
|
||||
"github.com/tim-beatham/wgmesh/pkg/mesh"
|
||||
"github.com/tim-beatham/wgmesh/pkg/robin"
|
||||
"github.com/tim-beatham/wgmesh/pkg/sync"
|
||||
timer "github.com/tim-beatham/wgmesh/pkg/timers"
|
||||
"golang.zx2c4.com/wireguard/wgctrl"
|
||||
)
|
||||
|
||||
@ -62,6 +63,7 @@ func main() {
|
||||
syncRequester = sync.NewSyncRequester(ctrlServer)
|
||||
syncer = sync.NewSyncer(ctrlServer.MeshManager, conf, syncRequester)
|
||||
syncScheduler := sync.NewSyncScheduler(ctrlServer, syncRequester, syncer)
|
||||
keepAlive := timer.NewTimestampScheduler(ctrlServer)
|
||||
|
||||
robinIpcParams := robin.RobinIpcParams{
|
||||
CtrlServer: ctrlServer,
|
||||
@ -79,10 +81,12 @@ func main() {
|
||||
|
||||
go ipc.RunIpcHandler(&robinIpc)
|
||||
go syncScheduler.Run()
|
||||
go keepAlive.Run()
|
||||
|
||||
closeResources := func() {
|
||||
logging.Log.WriteInfof("Closing resources")
|
||||
syncScheduler.Stop()
|
||||
keepAlive.Stop()
|
||||
ctrlServer.Close()
|
||||
client.Close()
|
||||
}
|
||||
|
Reference in New Issue
Block a user