|
@ -39,8 +39,6 @@ type TestReactor struct { |
|
|
|
|
|
|
|
|
mtx sync.Mutex |
|
|
mtx sync.Mutex |
|
|
channels []*conn.ChannelDescriptor |
|
|
channels []*conn.ChannelDescriptor |
|
|
peersAdded []Peer |
|
|
|
|
|
peersRemoved []Peer |
|
|
|
|
|
logMessages bool |
|
|
logMessages bool |
|
|
msgsCounter int |
|
|
msgsCounter int |
|
|
msgsReceived map[byte][]PeerMessage |
|
|
msgsReceived map[byte][]PeerMessage |
|
@ -61,17 +59,9 @@ func (tr *TestReactor) GetChannels() []*conn.ChannelDescriptor { |
|
|
return tr.channels |
|
|
return tr.channels |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (tr *TestReactor) AddPeer(peer Peer) { |
|
|
|
|
|
tr.mtx.Lock() |
|
|
|
|
|
defer tr.mtx.Unlock() |
|
|
|
|
|
tr.peersAdded = append(tr.peersAdded, peer) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func (tr *TestReactor) AddPeer(peer Peer) {} |
|
|
|
|
|
|
|
|
func (tr *TestReactor) RemovePeer(peer Peer, reason interface{}) { |
|
|
|
|
|
tr.mtx.Lock() |
|
|
|
|
|
defer tr.mtx.Unlock() |
|
|
|
|
|
tr.peersRemoved = append(tr.peersRemoved, peer) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func (tr *TestReactor) RemovePeer(peer Peer, reason interface{}) {} |
|
|
|
|
|
|
|
|
func (tr *TestReactor) Receive(chID byte, peer Peer, msgBytes []byte) { |
|
|
func (tr *TestReactor) Receive(chID byte, peer Peer, msgBytes []byte) { |
|
|
if tr.logMessages { |
|
|
if tr.logMessages { |
|
|