From 0fa83723b4ec88f2e48b48b711734eda712ed89f Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Mon, 30 Jul 2012 14:06:02 +0300 Subject: [PATCH] avoid one more crash --- cmd/cgr-rater/cgr-rater.go | 5 +++++ cmd/cgr-rater/registration.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/cgr-rater/cgr-rater.go b/cmd/cgr-rater/cgr-rater.go index cd3542dbb..678637c62 100644 --- a/cmd/cgr-rater/cgr-rater.go +++ b/cmd/cgr-rater/cgr-rater.go @@ -128,6 +128,11 @@ func readConfig(configFn string) { func listenToRPCRequests(rpcResponder interface{}, rpcAddress string, rpc_encoding string) { l, err := net.Listen("tcp", rpcAddress) + if err != nil { + timespans.Logger.Err(fmt.Sprintf("could not connect to %v: %v", rpcAddress, err)) + exitChan <- true + return + } defer l.Close() if err != nil { diff --git a/cmd/cgr-rater/registration.go b/cmd/cgr-rater/registration.go index b380f634d..4b1a89f7e 100644 --- a/cmd/cgr-rater/registration.go +++ b/cmd/cgr-rater/registration.go @@ -82,7 +82,7 @@ Connects to the balancer and rehisters the rater to the server. func registerToBalancer() { client, err := rpc.Dial("tcp", rater_balancer) if err != nil { - log.Print("Cannot contact the balancer!") + log.Print("Cannot contact the balancer!", err) exitChan <- true return }