blob: 018541cf6cbb2d22d86df0e35ad9db30f7f63689 [file] [log] [blame]
khenaidooab1f7bd2019-11-14 14:00:27 -05001// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build !go1.5
6
7package websocket
8
9import "io"
10
11func (c *Conn) read(n int) ([]byte, error) {
12 p, err := c.br.Peek(n)
13 if err == io.EOF {
14 err = errUnexpectedEOF
15 }
16 if len(p) > 0 {
17 // advance over the bytes just read
18 io.ReadFull(c.br, p)
19 }
20 return p, err
21}