From 782072e3fa11f32fe963c6b202de83d9e05f75b7 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 27 Feb 2016 16:15:42 -0600 Subject: [PATCH] Fixed not call port forwarding methods if spin up/down operations fail. --- servermanager.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/servermanager.go b/servermanager.go index 4fe8747..20e19d1 100644 --- a/servermanager.go +++ b/servermanager.go @@ -79,14 +79,16 @@ func (me *ServerManager) serveAction(action int) bool { switch action { case SERVERMANAGER_SPINUP: ip, err := me.server.Spinup(me.name) - me.addPortForwards(ip) - if err != nil { + if err == nil { + me.addPortForwards(ip) + } else { log.Println("ServerManager: Could not spin up "+me.name+":", err) } case SERVERMANAGER_SPINDOWN: err := me.server.Spindown(me.name) - me.rmPortForwards() - if err != nil { + if err == nil { + me.rmPortForwards() + } else { log.Println("ServerManager: Could not spin down "+me.name+":", err) } case SERVERMANAGER_STOP: