Commit d228f970 authored by Kirill Smelkov's avatar Kirill Smelkov

X Kill IdentifyPeer - requireIdentifyHello is good to use instead

parent d44994d6
// Copyright (C) 2016-2017 Nexedi SA and Contributors.
// Copyright (C) 2016-2020 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
......@@ -67,59 +67,6 @@ func Serve(ctx context.Context, l *neo.Listener, srv Server) error {
}
*/
/*
// FIXME kill vvv
// ----------------------------------------
// XXX goes away? (we need a func to make sure to recv RequestIdentification
// XXX and pass it to server main logic - whether to accept it or not should be
// XXX programmed there)
//
// IdentifyPeer identifies peer on the link
// it expects peer to send RequestIdentification packet and replies with AcceptIdentification if identification passes.
// returns information about identified node or error.
func IdentifyPeer(ctx context.Context, link *neonet.NodeLink, myNodeType proto.NodeType) (nodeInfo proto.RequestIdentification, err error) {
defer xerr.Contextf(&err, "%s: identify", link)
// the first conn must come with RequestIdentification packet
conn, err := link.Accept() //+ctx
if err != nil {
return nodeInfo, err
}
defer func() {
err2 := conn.Close()
if err == nil {
err = err2
// XXX also clear nodeInfo ?
}
}()
req := proto.RequestIdentification{}
_, err = conn.Expect(&req)
if err != nil {
return nodeInfo, err
}
// TODO (.NodeType, .UUID, .Address, .Name, .IdTimestamp) -> check + register to NM
// TODO hook here in logic to check identification request, assign nodeID etc
err = conn.Send(&proto.AcceptIdentification{
NodeType: myNodeType,
MyUUID: 0, // XXX
NumPartitions: 1, // XXX
NumReplicas: 1, // XXX
YourUUID: req.UUID,
})
if err != nil {
return nodeInfo, err
}
return req, nil
}
*/
// ----------------------------------------
......
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