Commit c5157312 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b9a07f51
......@@ -24,6 +24,7 @@ import (
"fmt"
"io"
"log"
"math"
"os"
"sync"
)
......@@ -124,6 +125,12 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
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
_ = nodeInfo
/*
......@@ -160,6 +167,8 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
m.stateMu.Unlock()
go func() {
var pkt NEOEncoder
for {
select {
case <-ctx.Done():
......@@ -168,12 +177,19 @@ func (m *Master) ServeLink(ctx context.Context, link *NodeLink) {
return
case nodeUpdateV := <-nodeCh:
// TODO
_ = nodeUpdateV
pkt = &NotifyNodeInformation{
IdTimestamp: math.NaN(), // XXX
NodeList: nodeUpdateV,
}
//case clusterState = <-clusterCh:
// changed = true
}
err = EncodeAndSend(connNotify, pkt)
if err != nil {
// XXX err
}
}
}()
......
......@@ -174,7 +174,7 @@ func (nt *NodeTable) Add(node *Node) {
// 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 {
// FIXME linear scan
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