peer: Use debug log for inability to start peer.

The inability for a peer to negotiate is not something that should be a
warning which implies something is wrong.  On the contrary, it is quite
expected that various peers will connect (or be connected to) that are
unable to properly negotiate for a variety of reasons.  One example would
be a peer that is too old.

Also, while here take care of a few style nits.
This commit is contained in:
Dave Collins 2016-10-27 21:54:13 -05:00
parent 214d975adf
commit 05126f6034
No known key found for this signature in database
GPG key ID: B8904D9D9C93D1F2

View file

@ -1865,7 +1865,7 @@ func (p *Peer) QueueInventory(invVect *wire.InvVect) {
p.outputInvChan <- invVect
}
// AssociateConnection associates the given conn to the peer. Calling this
// AssociateConnection associates the given conn to the peer. Calling this
// function when the peer is already connected will have no effect.
func (p *Peer) AssociateConnection(conn net.Conn) {
// Already connected?
@ -1893,7 +1893,7 @@ func (p *Peer) AssociateConnection(conn net.Conn) {
go func() {
if err := p.start(); err != nil {
log.Warnf("Cannot start peer %v: %v", p, err)
log.Debugf("Cannot start peer %v: %v", p, err)
p.Disconnect()
}
}()
@ -1970,7 +1970,6 @@ func (p *Peer) WaitForDisconnect() {
// peer. If the next message is not a version message or the version is not
// acceptable then return an error.
func (p *Peer) readRemoteVersionMsg() error {
// Read their version message.
msg, _, err := p.readMessage()
if err != nil {
@ -1999,7 +1998,6 @@ func (p *Peer) readRemoteVersionMsg() error {
// writeLocalVersionMsg writes our version message to the remote peer.
func (p *Peer) writeLocalVersionMsg() error {
localVerMsg, err := p.localVersionMsg()
if err != nil {
return err
@ -2019,7 +2017,6 @@ func (p *Peer) writeLocalVersionMsg() error {
// then sends our version message. If the events do not occur in that order then
// it returns an error.
func (p *Peer) negotiateInboundProtocol() error {
if err := p.readRemoteVersionMsg(); err != nil {
return err
}
@ -2031,7 +2028,6 @@ func (p *Peer) negotiateInboundProtocol() error {
// version message from the peer. If the events do not occur in that order then
// it returns an error.
func (p *Peer) negotiateOutboundProtocol() error {
if err := p.writeLocalVersionMsg(); err != nil {
return err
}