Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve reliability and logging of setup node. #381

Merged
merged 6 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go
go:
# - "1.13.x" At minimum the code should run make check on the latest two go versions in the default linux environment provided by Travis.
- "1.13.x"
- "1.14.x"
evanlinjin marked this conversation as resolved.
Show resolved Hide resolved

dist: xenial

Expand All @@ -19,6 +19,7 @@ before_install:
install:
- go get -u github.com/FiloSottile/vendorcheck
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin v1.27.0
- make tidy

before_script:
- ci_scripts/create-ip-aliases.sh
Expand Down
7 changes: 6 additions & 1 deletion cmd/setup-node/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package commands

import (
"bufio"
"context"
"encoding/json"
"io"
"io/ioutil"
Expand All @@ -10,6 +11,7 @@ import (
"os"

"github.com/SkycoinProject/dmsg/buildinfo"
"github.com/SkycoinProject/dmsg/cmdutil"
"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -87,7 +89,10 @@ var rootCmd = &cobra.Command{
}
}()

logger.Fatal(sn.Serve())
ctx, cancel := cmdutil.SignalContext(context.Background(), logger)
defer cancel()

logger.Fatal(sn.Serve(ctx))
},
}

Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/SkycoinProject/skywire-mainnet

go 1.13
go 1.14

require (
github.com/SkycoinProject/dmsg v0.2.2
Expand All @@ -10,7 +10,6 @@ require (
github.com/go-chi/chi v4.0.2+incompatible
github.com/google/uuid v1.1.1
github.com/gorilla/securecookie v1.1.1
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/libp2p/go-reuseport v0.0.1
github.com/mholt/archiver/v3 v3.3.0
github.com/pkg/profile v1.3.0
Expand All @@ -23,9 +22,7 @@ require (
github.com/spf13/cobra v0.0.5
github.com/stretchr/testify v1.5.1
go.etcd.io/bbolt v1.3.4
golang.org/x/crypto v0.0.0-20200427165652-729f1e841bcc // indirect
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
golang.org/x/sys v0.0.0-20200428200454-593003d681fa // indirect
golang.zx2c4.com/wireguard v0.0.20200320
nhooyr.io/websocket v1.8.2
)
Expand Down
12 changes: 3 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgo
github.com/klauspost/pgzip v1.2.1 h1:oIPZROsWuPHpOdMVWLuJZXwgjhrW8r1yEX8UqMyeNHM=
github.com/klauspost/pgzip v1.2.1/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
Expand Down Expand Up @@ -221,7 +220,6 @@ github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
Expand All @@ -247,9 +245,8 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200427165652-729f1e841bcc h1:ZGI/fILM2+ueot/UixBSoj9188jCAxVHEZEGhqq67I4=
golang.org/x/crypto v0.0.0-20200427165652-729f1e841bcc/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -286,9 +283,8 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200428200454-593003d681fa h1:yMbJOvnfYkO1dSAviTu/ZguZWLBTXx4xE3LYrxUCCiA=
golang.org/x/sys v0.0.0-20200428200454-593003d681fa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
Expand All @@ -299,7 +295,6 @@ golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
Expand All @@ -313,7 +308,6 @@ google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ij
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
6 changes: 3 additions & 3 deletions pkg/routefinder/rfclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type HTTPError struct {

// Client implements route finding operations.
type Client interface {
FindRoutes(ctx context.Context, rts []routing.PathEdges, opts *RouteOptions) (map[routing.PathEdges][]routing.Path, error)
FindRoutes(ctx context.Context, rts []routing.PathEdges, opts *RouteOptions) (map[routing.PathEdges][][]routing.Hop, error)
}

// APIClient implements Client interface
Expand All @@ -71,7 +71,7 @@ func NewHTTP(addr string, apiTimeout time.Duration) Client {

// FindRoutes returns routes from source skywire visor to destiny, that has at least the given minHops and as much
// the given maxHops as well as the reverse routes from destiny to source.
func (c *apiClient) FindRoutes(ctx context.Context, rts []routing.PathEdges, opts *RouteOptions) (map[routing.PathEdges][]routing.Path, error) {
func (c *apiClient) FindRoutes(ctx context.Context, rts []routing.PathEdges, opts *RouteOptions) (map[routing.PathEdges][][]routing.Hop, error) {
requestBody := &FindRoutesRequest{
Edges: rts,
Opts: opts,
Expand Down Expand Up @@ -113,7 +113,7 @@ func (c *apiClient) FindRoutes(ctx context.Context, rts []routing.PathEdges, opt
return nil, errors.New(apiErr.Error.Message)
}

var paths map[routing.PathEdges][]routing.Path
var paths map[routing.PathEdges][][]routing.Hop
err = json.NewDecoder(res.Body).Decode(&paths)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/routefinder/rfclient/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (r *mockClient) SetError(err error) {
}

// FindRoutes implements Client for MockClient
func (r *mockClient) FindRoutes(ctx context.Context, rts []routing.PathEdges, opts *RouteOptions) (map[routing.PathEdges][]routing.Path, error) {
func (r *mockClient) FindRoutes(ctx context.Context, rts []routing.PathEdges, opts *RouteOptions) (map[routing.PathEdges][][]routing.Hop, error) {
if r.err != nil {
return nil, r.err
}
Expand All @@ -36,7 +36,7 @@ func (r *mockClient) FindRoutes(ctx context.Context, rts []routing.PathEdges, op
return nil, fmt.Errorf("no edges provided to returns routes from")
}

return map[routing.PathEdges][]routing.Path{
return map[routing.PathEdges][][]routing.Hop{
[2]cipher.PubKey{rts[0][0], rts[0][1]}: {
{
routing.Hop{
Expand Down
18 changes: 9 additions & 9 deletions pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,15 @@ func (r *router) handleDataPacket(ctx context.Context, packet routing.Packet) er
return err
}

if rule.Type() == routing.RuleConsume {
if rule.Type() == routing.RuleReverse {
r.logger.Debugf("Handling packet of type %s with route ID %d", packet.Type(), packet.RouteID())
} else {
r.logger.Debugf("Handling packet of type %s with route ID %d and next ID %d", packet.Type(),
packet.RouteID(), rule.NextRouteID())
}

switch rule.Type() {
case routing.RuleForward, routing.RuleIntermediaryForward:
case routing.RuleForward, routing.RuleIntermediary:
r.logger.Infoln("Handling intermediary data packet")
return r.forwardPacket(ctx, packet, rule)
}
Expand Down Expand Up @@ -429,7 +429,7 @@ func (r *router) handleClosePacket(ctx context.Context, packet routing.Packet) e
return err
}

if rule.Type() == routing.RuleConsume {
if rule.Type() == routing.RuleReverse {
r.logger.Debugf("Handling packet of type %s with route ID %d", packet.Type(), packet.RouteID())
} else {
r.logger.Debugf("Handling packet of type %s with route ID %d and next ID %d", packet.Type(),
Expand All @@ -441,7 +441,7 @@ func (r *router) handleClosePacket(ctx context.Context, packet routing.Packet) e
r.rt.DelRules(routeIDs)
}()

if t := rule.Type(); t == routing.RuleIntermediaryForward {
if t := rule.Type(); t == routing.RuleIntermediary {
r.logger.Infoln("Handling intermediary close packet")
return r.forwardPacket(ctx, packet, rule)
}
Expand Down Expand Up @@ -489,7 +489,7 @@ func (r *router) handleKeepAlivePacket(ctx context.Context, packet routing.Packe
return err
}

if rule.Type() == routing.RuleConsume {
if rule.Type() == routing.RuleReverse {
r.logger.Debugf("Handling packet of type %s with route ID %d", packet.Type(), packet.RouteID())
} else {
r.logger.Debugf("Handling packet of type %s with route ID %d and next ID %d", packet.Type(),
Expand All @@ -498,7 +498,7 @@ func (r *router) handleKeepAlivePacket(ctx context.Context, packet routing.Packe

// propagate packet only for intermediary rule. forward rule workflow doesn't get here,
// consume rules should be omitted, activity is already updated
if t := rule.Type(); t == routing.RuleIntermediaryForward {
if t := rule.Type(); t == routing.RuleIntermediary {
r.logger.Infoln("Handling intermediary keep-alive packet")
return r.forwardPacket(ctx, packet, rule)
}
Expand Down Expand Up @@ -605,7 +605,7 @@ func (r *router) forwardPacket(ctx context.Context, packet routing.Packet, rule
func (r *router) RemoveRouteDescriptor(desc routing.RouteDescriptor) {
rules := r.rt.AllRules()
for _, rule := range rules {
if rule.Type() != routing.RuleConsume {
if rule.Type() != routing.RuleReverse {
continue
}

Expand All @@ -617,7 +617,7 @@ func (r *router) RemoveRouteDescriptor(desc routing.RouteDescriptor) {
}
}

func (r *router) fetchBestRoutes(src, dst cipher.PubKey, opts *DialOptions) (fwd, rev routing.Path, err error) {
func (r *router) fetchBestRoutes(src, dst cipher.PubKey, opts *DialOptions) (fwd, rev []routing.Hop, err error) {
// TODO(nkryuchkov): use opts
if opts == nil {
opts = DefaultDialOptions() // nolint
Expand Down Expand Up @@ -802,7 +802,7 @@ func (r *router) removeRouteGroupOfRule(rule routing.Rule) {
// we need to process only consume rules, cause we don't
// really care about the other ones, other rules removal
// doesn't affect our work here
if rule.Type() != routing.RuleConsume {
if rule.Type() != routing.RuleReverse {
log.
WithField("func", "removeRouteGroupOfRule").
WithField("rule", rule.Type().String()).
Expand Down
62 changes: 32 additions & 30 deletions pkg/router/routerclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,77 @@ package routerclient

import (
"context"
"fmt"
"io"
"net/rpc"

"github.com/SkycoinProject/dmsg/cipher"
"github.com/SkycoinProject/skycoin/src/util/logging"
"github.com/sirupsen/logrus"

"github.com/SkycoinProject/skywire-mainnet/pkg/routing"
"github.com/SkycoinProject/skywire-mainnet/pkg/snet"
)

const rpcName = "RPCGateway"
// RPCName is the RPC gateway object name.
const RPCName = "RPCGateway"

// Client is an RPC client for router.
// Client is used to interact with the router's API remotely. The setup node uses this.
type Client struct {
rpc *rpc.Client
rPK cipher.PubKey // public key of remote router
log logrus.FieldLogger
}

// NewClient creates a new Client.
func NewClient(ctx context.Context, dialer snet.Dialer, pk cipher.PubKey) (*Client, error) {
s, err := dialer.Dial(ctx, pk, snet.AwaitSetupPort)
func NewClient(ctx context.Context, dialer snet.Dialer, rPK cipher.PubKey) (*Client, error) {
s, err := dialer.Dial(ctx, rPK, snet.AwaitSetupPort)
if err != nil {
return nil, err
}
return NewClientFromRaw(s, rPK), nil
}

client := &Client{
rpc: rpc.NewClient(s),
// NewClientFromRaw creates a new client from a raw connection.
func NewClientFromRaw(conn io.ReadWriteCloser, rPK cipher.PubKey) *Client {
return &Client{
rpc: rpc.NewClient(conn),
rPK: rPK,
log: logging.MustGetLogger(fmt.Sprintf("router_client:%s", rPK.String())),
}

return client, nil
}

// Close closes a Client.
func (c *Client) Close() error {
if c == nil {
return nil
}

if err := c.rpc.Close(); err != nil {
return err
}

return nil
return c.rpc.Close()
}

// AddEdgeRules adds forward and consume rules to router (forward and reverse).
func (c *Client) AddEdgeRules(ctx context.Context, rules routing.EdgeRules) (bool, error) {
var ok bool
err := c.call(ctx, rpcName+".AddEdgeRules", rules, &ok)

func (c *Client) AddEdgeRules(ctx context.Context, rules routing.EdgeRules) (ok bool, err error) {
const method = "AddEdgeRules"
err = c.call(ctx, method, rules, &ok)
return ok, err
}

// AddIntermediaryRules adds intermediary rules to router.
func (c *Client) AddIntermediaryRules(ctx context.Context, rules []routing.Rule) (bool, error) {
var ok bool
err := c.call(ctx, rpcName+".AddIntermediaryRules", rules, &ok)

func (c *Client) AddIntermediaryRules(ctx context.Context, rules []routing.Rule) (ok bool, err error) {
const method = "AddIntermediaryRules"
err = c.call(ctx, method, rules, &ok)
return ok, err
}

// ReserveIDs reserves n IDs and returns them.
func (c *Client) ReserveIDs(ctx context.Context, n uint8) ([]routing.RouteID, error) {
var routeIDs []routing.RouteID
err := c.call(ctx, rpcName+".ReserveIDs", n, &routeIDs)

return routeIDs, err
func (c *Client) ReserveIDs(ctx context.Context, n uint8) (rtIDs []routing.RouteID, err error) {
const method = "ReserveIDs"
err = c.call(ctx, method, n, &rtIDs)
return rtIDs, err
}

func (c *Client) call(ctx context.Context, serviceMethod string, args interface{}, reply interface{}) error {
call := c.rpc.Go(serviceMethod, args, reply, nil)

func (c *Client) call(ctx context.Context, method string, args interface{}, reply interface{}) error {
call := c.rpc.Go(RPCName+"."+method, args, reply, nil)
select {
case <-ctx.Done():
return ctx.Err()
Expand Down
6 changes: 1 addition & 5 deletions pkg/router/routerclient/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,8 @@ func prepRPCServerAndClient(t *testing.T, r router.Router) (s *rpc.Server, cl *C
l, err := nettest.NewLocalListener("tcp")
require.NoError(t, err)

gateway := router.NewRPCGateway(r)

s = rpc.NewServer()
err = s.Register(gateway)
require.NoError(t, err)

require.NoError(t, s.Register(router.NewRPCGateway(r)))
go s.Accept(l)

conn, err := net.Dial("tcp", l.Addr().String())
Expand Down
Loading