From b4910ee6482a2d3228b2af59dac69fd1188d0eee Mon Sep 17 00:00:00 2001 From: William Hipschman Date: Tue, 1 Sep 2015 10:48:12 -0400 Subject: [PATCH] More Trace Cleanup --- lfs/client.go | 23 +++++------------------ lfs/http.go | 2 +- lfs/ntlm.go | 3 +-- lfs/transfer_queue.go | 2 +- 4 files changed, 8 insertions(+), 22 deletions(-) diff --git a/lfs/client.go b/lfs/client.go index 5bcf10b9..66017e41 100644 --- a/lfs/client.go +++ b/lfs/client.go @@ -35,7 +35,7 @@ var ( 403: "Authorization error: %s\nCheck that you have proper access to the repository", 404: "Repository or object not found: %s\nCheck that it exists and that you have proper access to it", 500: "Server error: %s", - } + } ) type objectError struct { @@ -157,8 +157,6 @@ func DownloadCheck(oid string) (*objectResource, error) { return nil, Error(err) } - defer tracerx.Printf("client-willhi DownLoadCheck EXIT") - io.Copy(ioutil.Discard, res.Body) res.Body.Close() @@ -301,7 +299,7 @@ func UploadCheck(oidPath string) (*objectResource, error) { if res.StatusCode == 200 { return nil, nil } - + if obj.Oid == "" { obj.Oid = oid } @@ -465,15 +463,12 @@ func doAPIRequest(req *http.Request, useCreds bool) (*http.Response, error) { func doHttpRequest(req *http.Request, creds Creds) (*http.Response, error) { res, err := Config.HttpClient().Do(req) - if Config.NTLM() { - tracerx.Printf("client: NTLM Request") + if Config.NTLM() { res, err = DoNTLMRequest(req, true) } else { res, err = Config.HttpClient().Do(req) } - - tracerx.Printf("a") - + if res == nil { res = &http.Response{ StatusCode: 0, @@ -592,20 +587,15 @@ func handleResponse(res *http.Response, creds Creds) error { func decodeApiResponse(res *http.Response, obj interface{}) error { ctype := res.Header.Get("Content-Type") - - tracerx.Printf("client decodeApiResponse: cType %s", ctype) - if !(lfsMediaTypeRE.MatchString(ctype) || jsonMediaTypeRE.MatchString(ctype)) { return nil } - err := json.NewDecoder(res.Body).Decode(obj) - + err := json.NewDecoder(res.Body).Decode(obj) io.Copy(ioutil.Discard, res.Body) res.Body.Close() if err != nil { - tracerx.Printf("client decodeApiResponse: JSON ERROR %s", err.Error()) return Errorf(err, "Unable to parse HTTP response for %s %s", res.Request.Method, res.Request.URL) } @@ -636,9 +626,6 @@ func newApiRequest(method, oid string) (*http.Request, error) { operation = "upload" } } - - tracerx.Printf("client-willhi endpoint:%s, operation:%s, method:%s", endpoint, operation, method) - res, err := sshAuthenticate(endpoint, operation, oid) if err != nil { diff --git a/lfs/http.go b/lfs/http.go index 839f44fe..b1affa2c 100644 --- a/lfs/http.go +++ b/lfs/http.go @@ -63,7 +63,7 @@ func (c *HttpClient) Do(req *http.Request) (*http.Response, error) { start := time.Now() res, err := c.Client.Do(req) - if err != nil { + if err != nil { return res, err } diff --git a/lfs/ntlm.go b/lfs/ntlm.go index b75f2f98..6fd75cab 100644 --- a/lfs/ntlm.go +++ b/lfs/ntlm.go @@ -12,7 +12,6 @@ import ( "fmt" //"os" "github.com/ThomsonReutersEikon/go-ntlm/ntlm" - "github.com/github/git-lfs/vendor/_nuts/github.com/rubyist/tracerx" ) @@ -83,7 +82,7 @@ func Negotiate(request *http.Request, message string) []byte{ var response, err = Config.HttpClient().Do(request) if err != nil{ - tracerx.Printf("ntlm: Negotiate Error %s", err.Error()) + panic(err.Error()) } ret := ParseChallengeMessage(response) diff --git a/lfs/transfer_queue.go b/lfs/transfer_queue.go index 2b2e1cad..adc8c4e8 100644 --- a/lfs/transfer_queue.go +++ b/lfs/transfer_queue.go @@ -141,7 +141,7 @@ func (q *TransferQueue) individualApiRoutine(apiWaiter chan interface{}) { q.wait.Done() continue } - + if apiWaiter != nil { // Signal to launch more individual api workers q.meter.Start() select {