κρμγ 8 years ago
parent
commit
aeb5fe4188
1 changed files with 3 additions and 1 deletions
  1. 3 1
      ipfs_api/api.go

+ 3 - 1
ipfs_api/api.go

@@ -20,7 +20,7 @@ type MyShell struct {
 }
 
 func reset() {
-	if sh == nil {
+	if sh == nil || !sh.IsUp(){
 		sh = &MyShell{
 			Url:    Addr,
 			Client: http.DefaultClient,
@@ -30,6 +30,8 @@ func reset() {
 		if id, err := sh.ID(); err == nil {
 			v0, _, _ := sh.Version()
 			log.Println("ipfs version", v0, "node", id.ID, "online")
+		} else {
+			sh = nil
 		}
 	}
 }