Commit c5157312 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b9a07f51
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
"fmt" "fmt"
"io" "io"
"log" "log"
"math"
"os" "os"
"sync" "sync"
) )
...@@ -124,6 +125,12 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) { ...@@ -124,6 +125,12 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
return return
} }
// TODO get connNotify as conn left after identification
connNotify, err := link.NewConn()
if err != nil {
panic("TODO") // XXX
}
// notify main logic node connects/disconnects // notify main logic node connects/disconnects
_ = nodeInfo _ = nodeInfo
/* /*
...@@ -160,6 +167,8 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) { ...@@ -160,6 +167,8 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
m.stateMu.Unlock() m.stateMu.Unlock()
go func() { go func() {
var pkt NEOEncoder
for { for {
select { select {
case <-ctx.Done(): case <-ctx.Done():
...@@ -168,12 +177,19 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) { ...@@ -168,12 +177,19 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
return return
case nodeUpdateV := <-nodeCh: case nodeUpdateV := <-nodeCh:
// TODO pkt = &NotifyNodeInformation{
_ = nodeUpdateV IdTimestamp: math.NaN(), // XXX
NodeList: nodeUpdateV,
}
//case clusterState = <-clusterCh: //case clusterState = <-clusterCh:
// changed = true // changed = true
} }
err = EncodeAndSend(connNotify, pkt)
if err != nil {
// XXX err
}
} }
}() }()
......
...@@ -174,7 +174,7 @@ func (nt *NodeTable) Add(node *Node) { ...@@ -174,7 +174,7 @@ func (nt *NodeTable) Add(node *Node) {
// TODO subscribe for changes on Add ? (notification via channel) // TODO subscribe for changes on Add ? (notification via channel)
// Lookup finds node by nodeID // Lookup finds node by uuid
func (nt *NodeTable) Lookup(uuid NodeUUID) *Node { func (nt *NodeTable) Lookup(uuid NodeUUID) *Node {
// FIXME linear scan // FIXME linear scan
for _, node := range nt.nodev { for _, node := range nt.nodev {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment