Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
a41e0b4d
Commit
a41e0b4d
authored
Jul 20, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7025320e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
52 deletions
+57
-52
go/neo/server/storage.go
go/neo/server/storage.go
+57
-52
No files found.
go/neo/server/storage.go
View file @
a41e0b4d
...
@@ -372,7 +372,7 @@ func (stor *Storage) ServeLink(ctx context.Context, link *neo.NodeLink) {
...
@@ -372,7 +372,7 @@ func (stor *Storage) ServeLink(ctx context.Context, link *neo.NodeLink) {
var
serveConn
func
(
context
.
Context
,
*
neo
.
Conn
)
var
serveConn
func
(
context
.
Context
,
*
neo
.
Conn
)
switch
nodeInfo
.
NodeType
{
switch
nodeInfo
.
NodeType
{
case
neo
.
CLIENT
:
case
neo
.
CLIENT
:
serveConn
=
stor
.
S
erveClient
serveConn
=
stor
.
s
erveClient
default
:
default
:
// XXX vvv should be reply to peer
// XXX vvv should be reply to peer
...
@@ -388,7 +388,7 @@ func (stor *Storage) ServeLink(ctx context.Context, link *neo.NodeLink) {
...
@@ -388,7 +388,7 @@ func (stor *Storage) ServeLink(ctx context.Context, link *neo.NodeLink) {
break
break
}
}
// XXX wrap conn close to happen here, not in
S
erveClient ?
// XXX wrap conn close to happen here, not in
s
erveClient ?
go
serveConn
(
ctx
,
conn
)
go
serveConn
(
ctx
,
conn
)
}
}
...
@@ -396,9 +396,9 @@ func (stor *Storage) ServeLink(ctx context.Context, link *neo.NodeLink) {
...
@@ -396,9 +396,9 @@ func (stor *Storage) ServeLink(ctx context.Context, link *neo.NodeLink) {
}
}
//
S
erveClient serves incoming connection on which peer identified itself as client
//
s
erveClient serves incoming connection on which peer identified itself as client
// XXX +error return?
// XXX +error return?
func
(
stor
*
Storage
)
S
erveClient
(
ctx
context
.
Context
,
conn
*
neo
.
Conn
)
{
func
(
stor
*
Storage
)
s
erveClient
(
ctx
context
.
Context
,
conn
*
neo
.
Conn
)
{
fmt
.
Printf
(
"stor: %s: serving new client conn
\n
"
,
conn
)
fmt
.
Printf
(
"stor: %s: serving new client conn
\n
"
,
conn
)
// rederive ctx to be also cancelled if M tells us StopOperation
// rederive ctx to be also cancelled if M tells us StopOperation
...
@@ -418,6 +418,12 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *neo.Conn) {
...
@@ -418,6 +418,12 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *neo.Conn) {
}()
}()
for
{
for
{
serveClient1
(
conn
)
// XXX err check
}
}
// serveClient1 serves 1 request from a client
func
(
stor
*
Storage
)
serveClient1
(
conn
*
neo
.
Conn
)
error
{
req
,
err
:=
conn
.
Recv
()
req
,
err
:=
conn
.
Recv
()
if
err
!=
nil
{
if
err
!=
nil
{
return
// XXX log / err / send error before closing
return
// XXX log / err / send error before closing
...
@@ -475,5 +481,4 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *neo.Conn) {
...
@@ -475,5 +481,4 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *neo.Conn) {
}
}
//req.Put(...)
//req.Put(...)
}
}
}
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