aboutsummaryrefslogtreecommitdiffstats
path: root/whisper/whisperv5/peer.go
diff options
context:
space:
mode:
authorgluk256 <gluk256@users.noreply.github.com>2017-04-10 05:49:22 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-04-10 05:49:22 +0800
commit9cd713551627a9b48e04a77f64a15ea6f829dcf4 (patch)
treef1849e61cd8269dfe9c70861f49216cf78acec3b /whisper/whisperv5/peer.go
parent8570ef19eb8dfe4e2a450525c589dec291f3a517 (diff)
downloaddexon-9cd713551627a9b48e04a77f64a15ea6f829dcf4.tar.gz
dexon-9cd713551627a9b48e04a77f64a15ea6f829dcf4.tar.zst
dexon-9cd713551627a9b48e04a77f64a15ea6f829dcf4.zip
whisper: big refactoring (#13852)
* whisper: GetMessages fixed; size restriction updated * whisper: made PoW and MaxMsgSize customizable * whisper: test added * whisper: sym key management changed * whisper: identity management refactored * whisper: API refactoring (Post and Filter) * whisper: big refactoring complete * whisper: spelling fix * whisper: variable topic size allowed for a filter * whisper: final update * whisper: formatting * whisper: file exchange introduced in wnode * whisper: bugfix * whisper: API updated + new tests * whisper: statistics updated * whisper: wnode server updated * whisper: allowed filtering for variable topic size * whisper: tests added * whisper: resolving merge conflicts * whisper: refactoring (documenting mostly) * whsiper: tests fixed * whisper: down cased error messages * whisper: documenting the API functions * whisper: logging fixed * whisper: fixed wnode parameters * whisper: logs fixed (typos)
Diffstat (limited to 'whisper/whisperv5/peer.go')
-rw-r--r--whisper/whisperv5/peer.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/whisper/whisperv5/peer.go b/whisper/whisperv5/peer.go
index 315401aea..184c4ebf8 100644
--- a/whisper/whisperv5/peer.go
+++ b/whisper/whisperv5/peer.go
@@ -55,13 +55,13 @@ func newPeer(host *Whisper, remote *p2p.Peer, rw p2p.MsgReadWriter) *Peer {
// into the network.
func (p *Peer) start() {
go p.update()
- log.Debug(fmt.Sprintf("%v: whisper started", p.peer))
+ log.Trace("start", "peer", p.ID())
}
// stop terminates the peer updater, stopping message forwarding to it.
func (p *Peer) stop() {
close(p.quit)
- log.Debug(fmt.Sprintf("%v: whisper stopped", p.peer))
+ log.Trace("stop", "peer", p.ID())
}
// handshake sends the protocol initiation status message to the remote peer and
@@ -78,19 +78,19 @@ func (p *Peer) handshake() error {
return err
}
if packet.Code != statusCode {
- return fmt.Errorf("peer sent %x before status packet", packet.Code)
+ return fmt.Errorf("peer [%x] sent packet %x before status packet", p.ID(), packet.Code)
}
s := rlp.NewStream(packet.Payload, uint64(packet.Size))
peerVersion, err := s.Uint()
if err != nil {
- return fmt.Errorf("bad status message: %v", err)
+ return fmt.Errorf("peer [%x] sent bad status message: %v", p.ID(), err)
}
if peerVersion != ProtocolVersion {
- return fmt.Errorf("protocol version mismatch %d != %d", peerVersion, ProtocolVersion)
+ return fmt.Errorf("peer [%x]: protocol version mismatch %d != %d", p.ID(), peerVersion, ProtocolVersion)
}
// Wait until out own status is consumed too
if err := <-errc; err != nil {
- return fmt.Errorf("failed to send status packet: %v", err)
+ return fmt.Errorf("peer [%x] failed to send status packet: %v", p.ID(), err)
}
return nil
}
@@ -110,7 +110,7 @@ func (p *Peer) update() {
case <-transmit.C:
if err := p.broadcast(); err != nil {
- log.Info(fmt.Sprintf("%v: broadcast failed: %v", p.peer, err))
+ log.Trace("broadcast failed", "reason", err, "peer", p.ID())
return
}
@@ -165,7 +165,7 @@ func (p *Peer) broadcast() error {
if err := p2p.Send(p.ws, messagesCode, transmit); err != nil {
return err
}
- log.Trace(fmt.Sprint(p.peer, "broadcasted", len(transmit), "message(s)"))
+ log.Trace("broadcast", "num. messages", len(transmit))
return nil
}