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
f73fc1ce
Commit
f73fc1ce
authored
Feb 18, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c3dbd4f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
12 deletions
+5
-12
go/neo/storage.go
go/neo/storage.go
+5
-12
No files found.
go/neo/storage.go
View file @
f73fc1ce
...
@@ -22,11 +22,10 @@ package neo
...
@@ -22,11 +22,10 @@ package neo
import
(
import
(
"context"
"context"
"errors"
"fmt"
"fmt"
"sync"
"sync"
"github.com/pkg/errors"
"lab.nexedi.com/kirr/go123/xcontext"
"lab.nexedi.com/kirr/go123/xcontext"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xnet"
"lab.nexedi.com/kirr/go123/xnet"
...
@@ -288,15 +287,9 @@ func (stor *Storage) serve(ctx context.Context) (err error) {
...
@@ -288,15 +287,9 @@ func (stor *Storage) serve(ctx context.Context) (err error) {
go
func
()
{
go
func
()
{
defer
wg
.
Done
()
defer
wg
.
Done
()
err
:=
stor
.
serveLink
(
ctx
,
req
,
idReq
)
err
:=
stor
.
serveLink
(
ctx
,
req
,
idReq
)
if
err
!=
nil
{
if
err
==
nil
{
// XXX log err XXX vvv ok?
if
ctx
.
Err
()
==
nil
{
switch
errors
.
Cause
(
err
)
{
// the error is not due to serve cancel
// XXX closed by main or peer down - all logged by main called
// XXX review
case
neonet
.
ErrLinkDown
,
neonet
.
ErrLinkClosed
:
// ok
default
:
log
.
Error
(
ctx
,
err
)
log
.
Error
(
ctx
,
err
)
}
}
}
}
...
@@ -367,7 +360,7 @@ func (stor *Storage) serveLink(ctx context.Context, req *neonet.Request, idReq *
...
@@ -367,7 +360,7 @@ func (stor *Storage) serveLink(ctx context.Context, req *neonet.Request, idReq *
// with O(1/nreq) rate (i.e. N(goroutine, nreq) ~ ln(nreq)).
// with O(1/nreq) rate (i.e. N(goroutine, nreq) ~ ln(nreq)).
//
//
// TODO -> do what go-fuse does:
// TODO -> do what go-fuse does:
// - serve request in the goroutine that received it
// - serve request in the goroutine that received it
(reduces latency)
// - spawn another goroutine to continue accept loop
// - spawn another goroutine to continue accept loop
// - limit number of such accept-loop goroutines by GOMAXPROC
// - limit number of such accept-loop goroutines by GOMAXPROC
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
wg
.
Go
(
func
(
ctx
context
.
Context
)
error
{
...
...
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