From 20908b3072a761971c19c6a753a8bebde30032dc Mon Sep 17 00:00:00 2001 From: Marcin Janczyk Date: Thu, 24 Sep 2015 22:42:14 +0200 Subject: [PATCH] Detect connection refused errors during API test on Windows The first run does not try to connect to API, as an address is not yet saved in configuration. The second run did not recognize corrently a refused connection. Fixes #1661. License: MIT Signed-off-by: Marcin Janczyk --- cmd/ipfs/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/ipfs/main.go b/cmd/ipfs/main.go index cc37aae41..eec4ae840 100644 --- a/cmd/ipfs/main.go +++ b/cmd/ipfs/main.go @@ -668,5 +668,6 @@ func apiClientForAddr(addr ma.Multiaddr) (cmdsHttp.Client, error) { } func isConnRefused(err error) bool { - return strings.Contains(err.Error(), "connection refused") + return strings.Contains(err.Error(), "connection refused") || + strings.Contains(err.Error(), "target machine actively refused it") }