mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-29 06:01:21 +00:00
prep for merge
This commit is contained in:
parent
5af22d6ee6
commit
f97ead4f5f
@ -466,6 +466,7 @@ FOR_LOOP:
|
||||
}
|
||||
case packetTypePong:
|
||||
c.Logger.Debug("Receive Pong")
|
||||
// Should we unset pongTimer if we get other packet?
|
||||
c.pongTimer.Unset()
|
||||
case packetTypeMsg:
|
||||
pkt, n, err := msgPacket{}, int(0), error(nil)
|
||||
|
@ -128,12 +128,10 @@ func TestSwitches(t *testing.T) {
|
||||
ch0Msg := "channel zero"
|
||||
ch1Msg := "channel foo"
|
||||
ch2Msg := "channel bar"
|
||||
ch3Msg := "channel baz"
|
||||
|
||||
s1.Broadcast(byte(0x00), ch0Msg)
|
||||
s1.Broadcast(byte(0x01), ch1Msg)
|
||||
s1.Broadcast(byte(0x02), ch2Msg)
|
||||
s1.TryBroadcast(byte(0x03), ch3Msg)
|
||||
|
||||
assertMsgReceivedWithTimeout(t, ch0Msg, byte(0x00), s2.Reactor("foo").(*TestReactor), 10*time.Millisecond, 5*time.Second)
|
||||
assertMsgReceivedWithTimeout(t, ch1Msg, byte(0x01), s2.Reactor("foo").(*TestReactor), 10*time.Millisecond, 5*time.Second)
|
||||
@ -326,15 +324,12 @@ func BenchmarkSwitches(b *testing.B) {
|
||||
|
||||
numSuccess, numFailure := 0, 0
|
||||
|
||||
// Send random message from foo channel to another with Broadcast
|
||||
// Send random message from foo channel to another
|
||||
for i := 0; i < b.N; i++ {
|
||||
chID := byte(i % 4)
|
||||
resultChan := s1.Broadcast(chID, "test data")
|
||||
for res := range resultChan {
|
||||
if !s1.peers.Has(res.PeerKey) {
|
||||
b.Errorf("unexpected peerKey: %s", res.PeerKey)
|
||||
}
|
||||
if res.Success {
|
||||
successChan := s1.Broadcast(chID, "test data")
|
||||
for s := range successChan {
|
||||
if s {
|
||||
numSuccess++
|
||||
} else {
|
||||
numFailure++
|
||||
@ -342,25 +337,7 @@ func BenchmarkSwitches(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
b.Logf("Broadcast: success: %v, failure: %v", numSuccess, numFailure)
|
||||
|
||||
// Send random message from foo channel to another with TryBroadcast
|
||||
for i := 0; i < b.N; i++ {
|
||||
chID := byte(i % 4)
|
||||
resultChan := s1.TryBroadcast(chID, "test data")
|
||||
for res := range resultChan {
|
||||
if !s1.peers.Has(res.PeerKey) {
|
||||
b.Errorf("unexpected peerKey: %s", res.PeerKey)
|
||||
}
|
||||
if res.Success {
|
||||
numSuccess++
|
||||
} else {
|
||||
numFailure++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b.Logf("TryBroadcast: success: %v, failure: %v", numSuccess, numFailure)
|
||||
b.Logf("success: %v, failure: %v", numSuccess, numFailure)
|
||||
|
||||
// Allow everything to flush before stopping switches & closing connections.
|
||||
b.StopTimer()
|
||||
|
Loading…
x
Reference in New Issue
Block a user