Fix parser bug around MSG protocol.

Make sure we do the right thing when no args are presented for an MSG, e.g. MSG <spc>.
Also do not parse at all of this is a client, only valid for routes.
This commit is contained in:
Derek Collison
2015-08-26 23:04:10 -07:00
parent a0ad3c7a8c
commit 8fb92dc7e2
4 changed files with 35 additions and 7 deletions

View File

@@ -344,6 +344,8 @@ func TestSplitDanglingArgBuf(t *testing.T) {
func TestSplitMsgArg(t *testing.T) {
_, c, _ := setupClient()
// Allow parser to process MSG
c.typ = ROUTER
b := make([]byte, 1024)
@@ -371,7 +373,7 @@ func TestSplitMsgArg(t *testing.T) {
}
func TestSplitBufferMsgOp(t *testing.T) {
c := &client{subs: hashmap.New()}
c := &client{subs: hashmap.New(), typ: ROUTER}
msg := []byte("MSG foo.bar QRSID:15:3 _INBOX.22 11\r\nhello world\r")
msg1 := msg[:2]
msg2 := msg[2:9]