Branch: refs/heads/master
Home: https://github.com/btcsuite/btcd
Commit: f41ff545be905bd658084772a5826f4d091f1e2d
https://github.com/btcsuite/btcd/commit/f41ff545be905bd658084772a5826f4d091f1e2d
Author: Dave Collins <[email protected]>
Date: 2015-11-24 (Tue, 24 Nov 2015)
Changed paths:
M server.go
Log Message:
-----------
server: Improve the persistent peer retry logic.
This fixes an issue introduced during the peer refactor where persistent
peers that failed the initial connection are not retried as intended.
It also improves the retry logic as follows:
- Make the retry handler goroutine simply use a for loop instead of
launching a new goroutine for each backoff attempt. Even though
goroutines are fairly cheap to create, it is much more efficient to
simply loop
- Change the retry handler to accept a flag if it is the initial attempt
- Rather than dividing the const interval by 2 everywhere and passing
the retry duration in, just half the constant and set the initial
duration to it in the retry handler
Finally, include the address of the peer in the error message when a new
outbound peer can't be created.