From 1a87cad022b9e838a08dd1f4cb39f55b91d99de3 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Fri, 22 Jul 2016 21:23:12 +0200
Subject: reliability fix and vet


diff --git a/rhimport/converter.go b/rhimport/converter.go
index 72f746d..6c63657 100644
--- a/rhimport/converter.go
+++ b/rhimport/converter.go
@@ -189,9 +189,11 @@ func NewBS1770FetchConverter(filename string, metadata map[string]string, sample
 		res, err := NewBS1770ResultFromXML(&bsStdout)
 		if err != nil {
 			bs.result <- FetchConverterResult{bsStdout.String(), err, 0.0}
+			return
 		}
 		if len(res.Album.Tracks) == 0 {
 			bs.result <- FetchConverterResult{bsStdout.String(), fmt.Errorf("bs1770gain returned no/invalid result"), 0.0}
+			return
 		}
 		bs.result <- FetchConverterResult{"", nil, res.Album.Tracks[0].Integrated.LU}
 	}()
@@ -285,9 +287,11 @@ func NewFFMpegBS1770FetchConverter(filename string, metadata map[string]string,
 		res, err := NewBS1770ResultFromXML(&bsStdout)
 		if err != nil {
 			ff.resultBS <- FetchConverterResult{bsStdout.String(), err, 0.0}
+			return
 		}
 		if len(res.Album.Tracks) == 0 {
 			ff.resultBS <- FetchConverterResult{bsStdout.String(), fmt.Errorf("bs1770gain returned no/invalid result"), 0.0}
+			return
 		}
 		ff.resultBS <- FetchConverterResult{"", nil, res.Album.Tracks[0].Integrated.LU}
 	}()
diff --git a/rhimport/session_store.go b/rhimport/session_store.go
index a511d52..4139f99 100644
--- a/rhimport/session_store.go
+++ b/rhimport/session_store.go
@@ -190,7 +190,7 @@ func (store *SessionStore) get(username, id string) (resp getSessionResponse) {
 	user, exists := store.store[username]
 	if !exists {
 		resp.responsecode = http.StatusNotFound
-		resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", user, id)
+		resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", username, id)
 	}
 
 	if session, exists := user.sessions[id]; exists {
@@ -198,7 +198,7 @@ func (store *SessionStore) get(username, id string) (resp getSessionResponse) {
 		resp.refId = session.refId
 	} else {
 		resp.responsecode = http.StatusNotFound
-		resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", user, id)
+		resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", username, id)
 	}
 	return
 }
@@ -241,7 +241,7 @@ func (store *SessionStore) remove(username, id string) (resp removeSessionRespon
 	user, exists := store.store[username]
 	if !exists {
 		resp.responsecode = http.StatusNotFound
-		resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", user, id)
+		resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", username, id)
 	}
 
 	if session, exists := user.sessions[id]; exists {
@@ -257,7 +257,7 @@ func (store *SessionStore) remove(username, id string) (resp removeSessionRespon
 		}
 	} else {
 		resp.responsecode = http.StatusNotFound
-		resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", user, id)
+		resp.errorstring = fmt.Sprintf("SessionStore: session '%s/%s' not found", username, id)
 	}
 	return
 }
-- 
cgit v0.10.2