This commit is contained in:
Derek Collison
2013-08-19 12:16:30 -07:00
parent a2c6cc309d
commit d322939b17
6 changed files with 8 additions and 8 deletions

View File

@@ -21,7 +21,7 @@ const (
defaultBufSize = 32768
// Scratch buffer size for the processMsg() calls.
msgScratchSize = 512
msgHeadProto = "MSG "
msgHeadProto = "MSG "
)
const (

View File

@@ -35,7 +35,7 @@ const (
DEFAULT_PING_MAX_OUT = 2
// CRLF string
CR_LF = "\r\n"
CR_LF = "\r\n"
LEN_CR_LF = len(CR_LF)
// Write/Flush Deadlines

View File

@@ -161,10 +161,10 @@ func (c *client) parse(buf []byte) error {
if c.msgBuf != nil {
c.msgBuf = append(c.msgBuf, b)
} else {
c.msgBuf = buf[c.as:i+1]
c.msgBuf = buf[c.as : i+1]
}
// strict check for proto
if len(c.msgBuf) != c.pa.size + LEN_CR_LF {
if len(c.msgBuf) != c.pa.size+LEN_CR_LF {
goto parseErr
}
c.processMsg(c.msgBuf)

View File

@@ -170,7 +170,7 @@ func TestParsePub(t *testing.T) {
}
// Clear snapshots
c.argBuf, c.msgBuf, c.state = nil, nil, OP_START
c.argBuf, c.msgBuf, c.state = nil, nil, OP_START
pub = []byte("PUB foo.bar INBOX.22 11\r\nhello world\r")
err = c.parse(pub)
@@ -245,7 +245,7 @@ func TestParseMsg(t *testing.T) {
}
// Clear snapshots
c.argBuf, c.msgBuf, c.state = nil, nil, OP_START
c.argBuf, c.msgBuf, c.state = nil, nil, OP_START
pub = []byte("MSG foo.bar RSID:1:2 INBOX.22 11\r\nhello world\r")
err = c.parse(pub)

View File

@@ -315,4 +315,4 @@ func (s *Server) numRoutes() int {
s.mu.Lock()
defer s.mu.Unlock()
return len(s.routes)
}
}

View File

@@ -79,7 +79,7 @@ var (
var (
ErrInvalidSubject = errors.New("Invalid Subject")
ErrNotFound = errors.New("No Matches Found")
ErrNotFound = errors.New("No Matches Found")
)
// split will split a subject into tokens