Commit f73fc1ce authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c3dbd4f1
...@@ -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 {
......
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