Skip to content

Commit

Permalink
Fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Nov 18, 2019
1 parent ffe80e0 commit 622ad1e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions pkg/router/route_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"time"

"github.com/SkycoinProject/dmsg/cipher"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/net/nettest"

Expand Down Expand Up @@ -91,14 +92,20 @@ func TestRouteGroup_SetDeadline(t *testing.T) {
_, rg := prepare()
now := time.Now()

require.NoError(t, rg.SetDeadline(now))
require.Equal(t, now.UnixNano(), rg.readDeadline)
require.Equal(t, now.UnixNano(), rg.writeDeadline)
assert.NoError(t, rg.SetDeadline(now))
assert.Equal(t, now.UnixNano(), rg.readDeadline)
assert.Equal(t, now.UnixNano(), rg.writeDeadline)
}

func TestRouteGroup_TestConn(t *testing.T) {
mp := func() (c1, c2 net.Conn, stop func(), err error) {
// TODO: implement
_, c1 = prepare()
_, c2 = prepare()
stop = func() {
assert.NoError(t, c1.Close())
assert.NoError(t, c2.Close())
}
err = nil
return
}
nettest.TestConn(t, mp)
Expand Down
2 changes: 1 addition & 1 deletion pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (r *router) saveRouteGroupRules(rules routing.EdgeRules) *RouteGroup {
}

rg.fwd = append(rg.fwd, rules.Forward)
rg.rvs = append(rg.fwd, rules.Reverse)
rg.rvs = append(rg.rvs, rules.Reverse)

tp := r.tm.Transport(rules.Forward.NextTransportID())
rg.tps = append(rg.tps, tp)
Expand Down

0 comments on commit 622ad1e

Please sign in to comment.