khenaidoo | 59ce9dd | 2019-11-11 13:05:32 -0500 | [diff] [blame] | 1 | // 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 | |||||
7 | package websocket | ||||
8 | |||||
9 | import "io" | ||||
10 | |||||
11 | func (c *Conn) read(n int) ([]byte, error) { | ||||
12 | p, err := c.br.Peek(n) | ||||
13 | if err == io.EOF { | ||||
14 | err = errUnexpectedEOF | ||||
15 | } | ||||
16 | c.br.Discard(len(p)) | ||||
17 | return p, err | ||||
18 | } |