Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
a317f201
Commit
a317f201
authored
Feb 22, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
92be102d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
go/neo/storage.go
go/neo/storage.go
+10
-5
No files found.
go/neo/storage.go
View file @
a317f201
...
...
@@ -75,7 +75,8 @@ func NewStorage(clusterName, masterAddr string, net xnet.Networker, back storage
// The storage will be serving incoming connections on l.
func
(
stor
*
Storage
)
Run
(
ctx
context
.
Context
,
l
xnet
.
Listener
)
(
err
error
)
{
addr
:=
l
.
Addr
()
log
.
Infof
(
ctx
,
"%s: listening on %s ..."
,
stor
.
node
.
MyInfo
.
NID
,
addr
)
// XXX WithState?
log
.
Infof
(
ctx
,
"%s: listening on %s ..."
,
stor
.
node
.
State
.
MyNID
,
addr
)
stor
.
runCtx
=
ctx
defer
func
()
{
...
...
@@ -88,7 +89,7 @@ func (stor *Storage) Run(ctx context.Context, l xnet.Listener) (err error) {
if
err
!=
nil
{
return
fmt
.
Errorf
(
"run @%s: %s"
,
addr
,
err
)
}
stor
.
node
.
MyInfo
.
Addr
=
naddr
stor
.
node
.
L
Addr
=
naddr
// wrap listener with link / identification hello checker
stor
.
lli
=
xneo
.
NewListener
(
neonet
.
NewLinkListener
(
l
))
...
...
@@ -213,7 +214,10 @@ func (stor *Storage) m1serve(ctx context.Context, mlink *_MasterLink, reqStart *
defer
task
.
Runningf
(
&
ctx
,
"mserve"
)(
&
err
)
// serve clients while operational
serveCtx
:=
taskctx
.
Runningf
(
stor
.
runCtx
,
"%s"
,
stor
.
node
.
MyInfo
.
NID
)
var
serveCtx
context
.
Context
stor
.
node
.
WithState
(
func
(
s
*
xneo
.
State
)
{
serveCtx
=
taskctx
.
Runningf
(
stor
.
runCtx
,
"%s"
,
s
.
MyNID
)
})
serveCtx
,
serveCancel
:=
xcontext
.
Merge
/*Cancel*/
(
serveCtx
,
ctx
)
wg
:=
sync
.
WaitGroup
{}
wg
.
Add
(
1
)
...
...
@@ -325,9 +329,10 @@ func (stor *Storage) identify_(idReq *proto.RequestIdentification) (proto.Msg, *
return
nil
,
&
proto
.
Error
{
proto
.
PROTOCOL_ERROR
,
"cluster name mismatch"
}
}
s
:=
stor
.
node
.
StateHead
()
// XXX ok instaed of stor.node.WithState?
return
&
proto
.
AcceptIdentification
{
NodeType
:
stor
.
node
.
MyInfo
.
Type
,
MyNID
:
s
tor
.
node
.
MyInfo
.
NID
,
// XXX lock wrt update
NodeType
:
stor
.
node
.
Type
,
MyNID
:
s
.
MyNID
,
YourNID
:
idReq
.
NID
,
},
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment