Browse Source

don't kill the client if a proxy connection fails, log error messages instead

Alan Shreve 12 years ago
parent
commit
694ef522ec
1 changed files with 12 additions and 3 deletions
  1. 12 3
      src/ngrok/client/main.go

+ 12 - 3
src/ngrok/client/main.go

@@ -53,14 +53,23 @@ func proxy(proxyAddr string, s *State, ctl *ui.Controller) {
 	start := time.Now()
 	remoteConn, err := connect(proxyAddr, "pxy")
 	if err != nil {
-		panic(err)
+                // XXX: What is the proper response here?
+                // display something to the user?
+                // retry?
+                // reset control connection?
+                log.Error("Failed to establish proxy connection: %v", err)
+                return
 	}
 
 	defer remoteConn.Close()
 	err = msg.WriteMsg(remoteConn, &msg.RegProxyMsg{Url: s.publicUrl})
-
 	if err != nil {
-		panic(err)
+                // XXX: What is the proper response here?
+                // display something to the user?
+                // retry?
+                // reset control connection?
+                log.Error("Failed to write RegProxyMsg: %v", err)
+                return
 	}
 
 	localConn, err := connect(s.opts.localaddr, "prv")