2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-09-19 18:45:48 +08:00

Remove the unncessary var and const blocks

This commit is contained in:
Soheil Hassas Yeganeh 2016-02-21 10:37:29 -05:00
parent 48deeb47a3
commit 3ca13bcd9e
2 changed files with 5 additions and 11 deletions

View File

@ -38,11 +38,9 @@ func (e errListenerClosed) Error() string { return string(e) }
func (e errListenerClosed) Temporary() bool { return false } func (e errListenerClosed) Temporary() bool { return false }
func (e errListenerClosed) Timeout() bool { return false } func (e errListenerClosed) Timeout() bool { return false }
var ( // ErrListenerClosed is returned from muxListener.Accept when the underlying
// ErrListenerClosed is returned from muxListener.Accept when the underlying // listener is closed.
// listener is closed. var ErrListenerClosed = errListenerClosed("mux: listener closed")
ErrListenerClosed = errListenerClosed("mux: listener closed")
)
// New instantiates a new connection multiplexer. // New instantiates a new connection multiplexer.
func New(l net.Listener) CMux { func New(l net.Listener) CMux {

View File

@ -46,9 +46,7 @@ func HTTP1Fast(extMethods ...string) Matcher {
return PrefixMatcher(append(defaultHTTPMethods, extMethods...)...) return PrefixMatcher(append(defaultHTTPMethods, extMethods...)...)
} }
const ( const maxHTTPRead = 4096
maxHTTPRead = 4096
)
// HTTP1 parses the first line or upto 4096 bytes of the request to see if // HTTP1 parses the first line or upto 4096 bytes of the request to see if
// the conection contains an HTTP request. // the conection contains an HTTP request.
@ -81,9 +79,7 @@ func parseRequestLine(line string) (method, uri, proto string, ok bool) {
return line[:s1], line[s1+1 : s2], line[s2+1:], true return line[:s1], line[s1+1 : s2], line[s2+1:], true
} }
var ( var http2Preface = []byte(http2.ClientPreface)
http2Preface = []byte(http2.ClientPreface)
)
// HTTP2 parses the frame header of the first frame to detect whether the // HTTP2 parses the frame header of the first frame to detect whether the
// connection is an HTTP2 connection. // connection is an HTTP2 connection.