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
5a938a10
Commit
5a938a10
authored
Jul 20, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7ecadf55
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
go/neo/server/storage.go
go/neo/server/storage.go
+5
-2
No files found.
go/neo/server/storage.go
View file @
5a938a10
...
...
@@ -155,16 +155,16 @@ func (stor *Storage) talkMaster(ctx context.Context) error {
// talkMaster1 does 1 cycle of connect/talk/disconnect to master
// it returns error describing why such cycle had to finish
// XXX distinguish between temporary problems and non-temporary ones?
func
(
stor
*
Storage
)
talkMaster1
(
ctx
context
.
Context
)
error
{
func
(
stor
*
Storage
)
talkMaster1
(
ctx
context
.
Context
)
(
err
error
)
{
Mlink
,
err
:=
neo
.
Dial
(
ctx
,
stor
.
net
,
stor
.
masterAddr
)
if
err
!=
nil
{
return
err
}
// close Mlink on return / cancel
defer
func
()
{
errClose
:=
Mlink
.
Close
()
err
=
xerr
.
First
(
err
,
errClose
)
// TODO Mlink.Close() on return / cancel
}()
// request identification this way registering our node to master
...
...
@@ -400,6 +400,7 @@ func (stor *Storage) withWhileOperational(ctx context.Context) (context.Context,
}
// serveClient serves incoming connection on which peer identified itself as client
// the connection is closed when serveClient returns
// XXX +error return?
func
(
stor
*
Storage
)
serveClient
(
ctx
context
.
Context
,
conn
*
neo
.
Conn
)
{
fmt
.
Printf
(
"stor: %s: serving new client conn
\n
"
,
conn
)
...
...
@@ -427,12 +428,14 @@ func (stor *Storage) serveClient(ctx context.Context, conn *neo.Conn) {
select
{
case
<-
ctx
.
Done
()
:
// XXX tell client we are shutting down?
// XXX should we also wait for main work to finish?
err
=
ctx
.
Err
()
case
err
=
<-
done
:
}
fmt
.
Printf
(
"stor: %v: %v
\n
"
,
conn
,
err
)
// XXX vvv -> defer ?
fmt
.
Printf
(
"stor: %v: closing client conn
\n
"
,
conn
)
conn
.
Close
()
// XXX err
}
...
...
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