Cleanup issues reported by golint.

This commit is contained in:
Gary Burd 2014-04-20 07:20:03 -07:00
parent f5c69ea9ed
commit f867cb5c72
2 changed files with 11 additions and 6 deletions

15
conn.go
View File

@ -61,7 +61,12 @@ var (
)
var (
// ErrCloseSent is returned when the application writes a message to the
// connection after sending a close message.
ErrCloseSent = errors.New("websocket: close sent")
// ErrReadLimit is returned when reading a message that is larger than the
// read limit set for the connection.
ErrReadLimit = errors.New("websocket: read limit exceeded")
)
@ -101,7 +106,7 @@ func isData(frameType int) bool {
func maskBytes(key [4]byte, pos int, b []byte) int {
for i := range b {
b[i] ^= key[pos&3]
pos += 1
pos++
}
return pos & 3
}
@ -302,7 +307,7 @@ func (c *Conn) flushFrame(final bool, extra []byte) error {
// Check for invalid control frames.
if isControl(c.writeFrameType) &&
(!final || length > maxControlFramePayloadSize) {
c.writeSeq += 1
c.writeSeq++
c.writeFrameType = noFrame
c.writePos = maxFrameHeaderSize
return errInvalidControlFrame
@ -357,7 +362,7 @@ func (c *Conn) flushFrame(final bool, extra []byte) error {
c.writePos = maxFrameHeaderSize
c.writeFrameType = continuationFrame
if final {
c.writeSeq += 1
c.writeSeq++
c.writeFrameType = noFrame
}
return c.writeErr
@ -666,7 +671,7 @@ func (c *Conn) read(buf []byte) error {
// accessed by more than one goroutine at a time.
func (c *Conn) NextReader() (messageType int, r io.Reader, err error) {
c.readSeq += 1
c.readSeq++
c.readLength = 0
for c.readErr == nil {
@ -703,7 +708,7 @@ func (r messageReader) Read(b []byte) (n int, err error) {
}
if r.c.readFinal {
r.c.readSeq += 1
r.c.readSeq++
return 0, io.EOF
}

View File

@ -15,7 +15,7 @@ import (
"time"
)
var timeoutErrImplementsNetError net.Error = errWriteTimeout
var _ net.Error = errWriteTimeout
type fakeNetConn struct {
io.Reader