mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
remove BufferedReader.Direct
This commit is contained in:
parent
1b39199adf
commit
2e11653694
@ -90,8 +90,6 @@ type BufferedReader struct {
|
||||
Reader Reader
|
||||
// Buffer is the internal buffer to be read from first
|
||||
Buffer MultiBuffer
|
||||
// Direct indicates whether or not to use the internal buffer
|
||||
Direct bool
|
||||
}
|
||||
|
||||
// BufferedBytes returns the number of bytes that is cached in this reader.
|
||||
@ -118,12 +116,6 @@ func (r *BufferedReader) Read(b []byte) (int, error) {
|
||||
return nBytes, nil
|
||||
}
|
||||
|
||||
if r.Direct {
|
||||
if reader, ok := r.Reader.(io.Reader); ok {
|
||||
return reader.Read(b)
|
||||
}
|
||||
}
|
||||
|
||||
mb, err := r.Reader.ReadMultiBuffer()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
|
@ -104,7 +104,6 @@ func NewAuthenticationReader(auth Authenticator, sizeParser ChunkSizeDecoder, re
|
||||
sizeBytes: make([]byte, sizeParser.SizeBytes()),
|
||||
}
|
||||
if breader, ok := reader.(*buf.BufferedReader); ok {
|
||||
breader.Direct = false
|
||||
r.reader = breader
|
||||
} else {
|
||||
r.reader = &buf.BufferedReader{Reader: buf.NewReader(reader)}
|
||||
|
@ -103,8 +103,6 @@ func ReadTCPSession(user *protocol.User, reader io.Reader) (*protocol.RequestHea
|
||||
return nil, nil, newError("invalid remote address.")
|
||||
}
|
||||
|
||||
br.Direct = true
|
||||
|
||||
var chunkReader buf.Reader
|
||||
if request.Option.Has(RequestOptionOneTimeAuth) {
|
||||
chunkReader = NewChunkReader(br, NewAuthenticator(ChunkKeyGenerator(iv)))
|
||||
|
@ -171,8 +171,6 @@ func (s *Server) handleConnection(ctx context.Context, conn internet.Connection,
|
||||
}
|
||||
conn.SetReadDeadline(time.Time{})
|
||||
|
||||
bufferedReader.Direct = true
|
||||
|
||||
dest := request.Destination()
|
||||
log.Record(&log.AccessMessage{
|
||||
From: conn.RemoteAddr(),
|
||||
|
@ -160,7 +160,6 @@ func (v *Handler) Process(ctx context.Context, link *core.Link, dialer proxy.Dia
|
||||
}
|
||||
v.handleCommand(rec.Destination(), header.Command)
|
||||
|
||||
reader.Direct = true
|
||||
bodyReader := session.DecodeResponseBody(request, reader)
|
||||
|
||||
return buf.Copy(bodyReader, output, buf.UpdateActivity(timer))
|
||||
|
Loading…
Reference in New Issue
Block a user