Skip to content

Commit

Permalink
fix: fmt error
Browse files Browse the repository at this point in the history
  • Loading branch information
Woosang Son committed Nov 2, 2020
1 parent fcf090e commit 081e650
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions p2p/switch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,12 +790,12 @@ func (book *addrBookMock) Save() {}
type NormalReactor struct {
BaseReactor
channels []*conn.ChannelDescriptor
msgChan chan []byte
msgChan chan []byte
}

func NewNormalReactor(channels []*conn.ChannelDescriptor, async bool, recvBufSize int) *NormalReactor {
nr := &NormalReactor{
channels: channels,
channels: channels,
}
nr.BaseReactor = *NewBaseReactor("NormalReactor", nr, async, recvBufSize)
nr.msgChan = make(chan []byte)
Expand Down Expand Up @@ -823,7 +823,7 @@ type BlockedReactor struct {

func NewBlockedReactor(channels []*conn.ChannelDescriptor, async bool, recvBufSize int) *BlockedReactor {
br := &BlockedReactor{
channels: channels,
channels: channels,
}
br.BaseReactor = *NewBaseReactor("BlockedReactor", br, async, recvBufSize)
br.waitChan = make(chan int, 1)
Expand All @@ -844,7 +844,7 @@ func (br *BlockedReactor) Receive(chID byte, peer Peer, msgBytes []byte) {
}

const (
reactorNameNormal = "normal"
reactorNameNormal = "normal"
reactorNameBlocked = "blocked"
)

Expand All @@ -856,14 +856,14 @@ func TestSyncReactor(t *testing.T) {

normalReactor := s2.Reactor(reactorNameNormal).(*NormalReactor)
blockedReactor := s2.Reactor(reactorNameBlocked).(*BlockedReactor)
s1.Broadcast(0x01, []byte{1}) // the message for blocked reactor is first
s1.Broadcast(0x01, []byte{1}) // the message for blocked reactor is first
time.Sleep(time.Millisecond * 200) // to make order among messages
s1.Broadcast(0x00, []byte{0}) // and then second message is for normal reactor
s1.Broadcast(0x00, []byte{0}) // and then second message is for normal reactor

select {
case <-normalReactor.msgChan:
assert.Fail(t, "blocked reactor is not blocked")
case <- time.After(time.Second * 1):
case <-time.After(time.Second * 1):
assert.True(t, true, "blocked reactor is blocked: OK")
}

Expand All @@ -881,14 +881,14 @@ func TestAsyncReactor(t *testing.T) {
defer s2.Stop()

normalReactor := s2.Reactor(reactorNameNormal).(*NormalReactor)
s1.Broadcast(0x01, []byte{1}) // the message for blocked reactor is first
s1.Broadcast(0x01, []byte{1}) // the message for blocked reactor is first
time.Sleep(time.Millisecond * 200) // to make order among messages
s1.Broadcast(0x00, []byte{0}) // and then second message is for normal reactor
s1.Broadcast(0x00, []byte{0}) // and then second message is for normal reactor

select {
case msg := <-normalReactor.msgChan:
assert.True(t, bytes.Equal(msg, []byte{0}))
case <- time.After(time.Second * 1):
case <-time.After(time.Second * 1):
assert.Fail(t, "blocked reactor is blocked")
}
}
Expand All @@ -909,4 +909,4 @@ func getInitSwitchFunc(bufSize int) func(int, *Switch, *config.P2PConfig) *Switc

return sw
}
}
}
2 changes: 1 addition & 1 deletion privval/signer_listener_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (
testTimeoutAccept = defaultTimeoutAcceptSeconds * time.Second

testTimeoutReadWrite = 1000 * time.Millisecond // increase timeout for slow test env
testTimeoutReadWrite2o3 = 60 * time.Millisecond // 2/3 of the other one
testTimeoutReadWrite2o3 = 60 * time.Millisecond // 2/3 of the other one
)

type dialerTestCase struct {
Expand Down

0 comments on commit 081e650

Please sign in to comment.