From 189dee26c6c00074ca8fb3ffd81faaf4bbc6825a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 20 Feb 2017 19:41:54 +0200 Subject: [PATCH] p2p: remove trailing newlines from log messages --- p2p/dial.go | 2 +- p2p/discover/udp.go | 6 +++--- p2p/discv5/udp.go | 4 ++-- p2p/nat/nat.go | 10 +++++----- p2p/peer.go | 16 ++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/p2p/dial.go b/p2p/dial.go index 57fba136a..1f5c0f15a 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -296,7 +296,7 @@ func (t *dialTask) resolve(srv *Server) bool { // dial performs the actual connection attempt. func (t *dialTask) dial(srv *Server, dest *discover.Node) bool { addr := &net.TCPAddr{IP: dest.IP, Port: int(dest.TCP)} - glog.V(logger.Debug).Infof("dial tcp %v (%x)\n", addr, dest.ID[:6]) + glog.V(logger.Debug).Infof("dial tcp %v (%x)", addr, dest.ID[:6]) fd, err := srv.Dialer.Dial("tcp", addr.String()) if err != nil { glog.V(logger.Detail).Infof("%v", err) diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index e09c63ffb..ae7f97029 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -464,7 +464,7 @@ func (t *udp) send(toaddr *net.UDPAddr, ptype byte, req interface{}) error { if err != nil { return err } - glog.V(logger.Detail).Infof(">>> %v %T\n", toaddr, req) + glog.V(logger.Detail).Infof(">>> %v %T", toaddr, req) if _, err = t.conn.WriteToUDP(packet, toaddr); err != nil { glog.V(logger.Detail).Infoln("UDP send failed:", err) } @@ -518,14 +518,14 @@ func (t *udp) readLoop() { func (t *udp) handlePacket(from *net.UDPAddr, buf []byte) error { packet, fromID, hash, err := decodePacket(buf) if err != nil { - glog.V(logger.Debug).Infof("Bad packet from %v: %v\n", from, err) + glog.V(logger.Debug).Infof("Bad packet from %v: %v", from, err) return err } status := "ok" if err = packet.handle(t, from, fromID, hash); err != nil { status = err.Error() } - glog.V(logger.Detail).Infof("<<< %v %T: %s\n", from, packet, status) + glog.V(logger.Detail).Infof("<<< %v %T: %s", from, packet, status) return err } diff --git a/p2p/discv5/udp.go b/p2p/discv5/udp.go index b43f6d198..6cf6cfbcc 100644 --- a/p2p/discv5/udp.go +++ b/p2p/discv5/udp.go @@ -348,7 +348,7 @@ func (t *udp) sendPacket(toid NodeID, toaddr *net.UDPAddr, ptype byte, req inter //fmt.Println(err) return hash, err } - glog.V(logger.Detail).Infof(">>> %v to %x@%v\n", nodeEvent(ptype), toid[:8], toaddr) + glog.V(logger.Detail).Infof(">>> %v to %x@%v", nodeEvent(ptype), toid[:8], toaddr) if _, err = t.conn.WriteToUDP(packet, toaddr); err != nil { glog.V(logger.Detail).Infoln("UDP send failed:", err) } @@ -407,7 +407,7 @@ func (t *udp) readLoop() { func (t *udp) handlePacket(from *net.UDPAddr, buf []byte) error { pkt := ingressPacket{remoteAddr: from} if err := decodePacket(buf, &pkt); err != nil { - glog.V(logger.Debug).Infof("Bad packet from %v: %v\n", from, err) + glog.V(logger.Debug).Infof("Bad packet from %v: %v", from, err) //fmt.Println("bad packet", err) return err } diff --git a/p2p/nat/nat.go b/p2p/nat/nat.go index f9ba93613..7eb23fa7b 100644 --- a/p2p/nat/nat.go +++ b/p2p/nat/nat.go @@ -102,13 +102,13 @@ func Map(m Interface, c chan struct{}, protocol string, extport, intport int, na refresh := time.NewTimer(mapUpdateInterval) defer func() { refresh.Stop() - glog.V(logger.Debug).Infof("deleting port mapping: %s %d -> %d (%s) using %s\n", protocol, extport, intport, name, m) + glog.V(logger.Debug).Infof("deleting port mapping: %s %d -> %d (%s) using %s", protocol, extport, intport, name, m) m.DeleteMapping(protocol, extport, intport) }() if err := m.AddMapping(protocol, extport, intport, name, mapTimeout); err != nil { - glog.V(logger.Debug).Infof("network port %s:%d could not be mapped: %v\n", protocol, intport, err) + glog.V(logger.Debug).Infof("network port %s:%d could not be mapped: %v", protocol, intport, err) } else { - glog.V(logger.Info).Infof("mapped network port %s:%d -> %d (%s) using %s\n", protocol, extport, intport, name, m) + glog.V(logger.Info).Infof("mapped network port %s:%d -> %d (%s) using %s", protocol, extport, intport, name, m) } for { select { @@ -117,9 +117,9 @@ func Map(m Interface, c chan struct{}, protocol string, extport, intport int, na return } case <-refresh.C: - glog.V(logger.Detail).Infof("refresh port mapping %s:%d -> %d (%s) using %s\n", protocol, extport, intport, name, m) + glog.V(logger.Detail).Infof("refresh port mapping %s:%d -> %d (%s) using %s", protocol, extport, intport, name, m) if err := m.AddMapping(protocol, extport, intport, name, mapTimeout); err != nil { - glog.V(logger.Debug).Infof("network port %s:%d could not be mapped: %v\n", protocol, intport, err) + glog.V(logger.Debug).Infof("network port %s:%d could not be mapped: %v", protocol, intport, err) } refresh.Reset(mapUpdateInterval) } diff --git a/p2p/peer.go b/p2p/peer.go index b9d6c099d..b21c872d6 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -157,27 +157,27 @@ loop: // A write finished. Allow the next write to start if // there was no error. if err != nil { - glog.V(logger.Detail).Infof("%v: write error: %v\n", p, err) + glog.V(logger.Detail).Infof("%v: write error: %v", p, err) reason = DiscNetworkError break loop } writeStart <- struct{}{} case err := <-readErr: if r, ok := err.(DiscReason); ok { - glog.V(logger.Debug).Infof("%v: remote requested disconnect: %v\n", p, r) + glog.V(logger.Debug).Infof("%v: remote requested disconnect: %v", p, r) requested = true reason = r } else { - glog.V(logger.Detail).Infof("%v: read error: %v\n", p, err) + glog.V(logger.Detail).Infof("%v: read error: %v", p, err) reason = DiscNetworkError } break loop case err := <-p.protoErr: reason = discReasonForError(err) - glog.V(logger.Debug).Infof("%v: protocol error: %v (%v)\n", p, err, reason) + glog.V(logger.Debug).Infof("%v: protocol error: %v (%v)", p, err, reason) break loop case reason = <-p.disc: - glog.V(logger.Debug).Infof("%v: locally requested disconnect: %v\n", p, reason) + glog.V(logger.Debug).Infof("%v: locally requested disconnect: %v", p, reason) break loop } } @@ -298,14 +298,14 @@ func (p *Peer) startProtocols(writeStart <-chan struct{}, writeErr chan<- error) proto.closed = p.closed proto.wstart = writeStart proto.werr = writeErr - glog.V(logger.Detail).Infof("%v: Starting protocol %s/%d\n", p, proto.Name, proto.Version) + glog.V(logger.Detail).Infof("%v: Starting protocol %s/%d", p, proto.Name, proto.Version) go func() { err := proto.Run(p, proto) if err == nil { - glog.V(logger.Detail).Infof("%v: Protocol %s/%d returned\n", p, proto.Name, proto.Version) + glog.V(logger.Detail).Infof("%v: Protocol %s/%d returned", p, proto.Name, proto.Version) err = errors.New("protocol returned") } else if err != io.EOF { - glog.V(logger.Detail).Infof("%v: Protocol %s/%d error: %v\n", p, proto.Name, proto.Version, err) + glog.V(logger.Detail).Infof("%v: Protocol %s/%d error: %v", p, proto.Name, proto.Version, err) } p.protoErr <- err p.wg.Done()