From 06b4277e6d2098b46853e3209fc01b9fcc8d4360 Mon Sep 17 00:00:00 2001 From: Edward Muller Date: Tue, 10 Feb 2015 09:18:18 -0800 Subject: [PATCH] Small cleanup --- rfc6587_test.go | 2 +- server.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/rfc6587_test.go b/rfc6587_test.go index d79be55..9abd4a2 100644 --- a/rfc6587_test.go +++ b/rfc6587_test.go @@ -61,7 +61,7 @@ func TestBadSplit(t *testing.T) { if err := scanner.Err(); err == nil { t.Error("Expected an error, but didn't get one") } else { - t.Log("Error: ", err) + t.Log("Error was: ", err) } } diff --git a/server.go b/server.go index b557e9a..30f561e 100644 --- a/server.go +++ b/server.go @@ -169,9 +169,10 @@ func rfc6587ScannerSplit(data []byte, atEOF bool) (advance int, token []byte, er if err != nil { return 0, nil, err } - if len(data) >= length+i+1 { + end := length + i + 1 + if len(data) >= end { //Return the frame with the length removed - return length + i + 1, data[i+1 : length+i+1], nil + return end, data[i+1 : end], nil } }