Commit f73fc1ce authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c3dbd4f1
......@@ -22,11 +22,10 @@ package neo
import (
"context"
"errors"
"fmt"
"sync"
"github.com/pkg/errors"
"lab.nexedi.com/kirr/go123/xcontext"
"lab.nexedi.com/kirr/go123/xerr"
"lab.nexedi.com/kirr/go123/xnet"
......@@ -288,15 +287,9 @@ func (stor *Storage) serve(ctx context.Context) (err error) {
go func() {
defer wg.Done()
err := stor.serveLink(ctx, req, idReq)
if err != nil {
// XXX log err XXX vvv ok?
switch errors.Cause(err) {
// XXX closed by main or peer down - all logged by main called
// XXX review
case neonet.ErrLinkDown, neonet.ErrLinkClosed:
// ok
default:
if err == nil {
if ctx.Err() == nil {
// the error is not due to serve cancel
log.Error(ctx, err)
}
}
......@@ -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)).
//
// 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
// - limit number of such accept-loop goroutines by GOMAXPROC
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