κρμγ před 8 roky
rodič
revize
aeb5fe4188
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 3 1
      ipfs_api/api.go

+ 3 - 1
ipfs_api/api.go

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