fix node-node-sync routing
This commit is contained in:
parent
c88ba03b66
commit
5d65ad3e4b
2 changed files with 8 additions and 3 deletions
|
|
@ -335,7 +335,11 @@ func (r *LuxRouter) Recv() (LuxPacket, error) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// on the node, we always operate by target ID
|
// on the node, we always operate by target ID
|
||||||
routeId = &route.Target
|
// routeId = &route.Target
|
||||||
|
|
||||||
|
// Above statement is not the case anymore, as nodes use same LuxRouteTypeFromSource
|
||||||
|
// type of routing that allows not using target node key AND solves route identification issues
|
||||||
|
routeId = &key.Id
|
||||||
}
|
}
|
||||||
|
|
||||||
if !bytes.Equal(packet.Target.UUID[:], routeId.UUID[:]) {
|
if !bytes.Equal(packet.Target.UUID[:], routeId.UUID[:]) {
|
||||||
|
|
@ -449,7 +453,6 @@ func (r *LuxRouter) Multicast(packet LuxPacket, group proto.LuxType) error {
|
||||||
targetKey, _ := r.keyStore.Get(route.Target)
|
targetKey, _ := r.keyStore.Get(route.Target)
|
||||||
|
|
||||||
if targetKey.Type == group {
|
if targetKey.Type == group {
|
||||||
packet.Target = key.Id
|
|
||||||
packet.Nonce = GenerateLuxNonce()
|
packet.Nonce = GenerateLuxNonce()
|
||||||
dgram, err := EncryptLuxPacket(packet, key, route.Destination)
|
dgram, err := EncryptLuxPacket(packet, key, route.Destination)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,8 @@ func (node *LuxNode) handleSync(packet *net.LuxPacket) {
|
||||||
key, _ := node.router.GetRouteKey(route)
|
key, _ := node.router.GetRouteKey(route)
|
||||||
if _, ok := sync.Synced[key.Id]; !ok {
|
if _, ok := sync.Synced[key.Id]; !ok {
|
||||||
// not in synced list - sending!
|
// not in synced list - sending!
|
||||||
newSyncPacket.Target = key.Id
|
//newSyncPacket.Target = key.Id
|
||||||
|
newSyncPacket.Target = route.Target
|
||||||
node.router.Send(newSyncPacket)
|
node.router.Send(newSyncPacket)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -304,6 +305,7 @@ func (node *LuxNode) MulticastSync() error {
|
||||||
// are populated neighbors
|
// are populated neighbors
|
||||||
packet := net.LuxPacket{
|
packet := net.LuxPacket{
|
||||||
Type: net.LuxPacketTypeSync,
|
Type: net.LuxPacketTypeSync,
|
||||||
|
Target: *node.nodeId,
|
||||||
Buffer: proto.NewLuxBuffer(),
|
Buffer: proto.NewLuxBuffer(),
|
||||||
}
|
}
|
||||||
sync.Write(&packet.Buffer)
|
sync.Write(&packet.Buffer)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue