mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-17 23:06:30 -05:00
release all readers and writers
This commit is contained in:
parent
70f803173a
commit
42b8dbe871
@ -95,8 +95,10 @@ func (this *SocksServer) handleConnection(connection *hub.TCPConn) {
|
|||||||
|
|
||||||
timedReader := v2net.NewTimeOutReader(120, connection)
|
timedReader := v2net.NewTimeOutReader(120, connection)
|
||||||
reader := v2io.NewBufferedReader(timedReader)
|
reader := v2io.NewBufferedReader(timedReader)
|
||||||
|
defer reader.Release()
|
||||||
|
|
||||||
writer := v2io.NewBufferedWriter(connection)
|
writer := v2io.NewBufferedWriter(connection)
|
||||||
|
defer writer.Release()
|
||||||
|
|
||||||
auth, auth4, err := protocol.ReadAuthentication(reader)
|
auth, auth4, err := protocol.ReadAuthentication(reader)
|
||||||
if err != nil && err != protocol.Socks4Downgrade {
|
if err != nil && err != protocol.Socks4Downgrade {
|
||||||
|
@ -90,6 +90,7 @@ func (this *VMessOutboundHandler) handleRequest(session *raw.ClientSession, conn
|
|||||||
defer finish.Unlock()
|
defer finish.Unlock()
|
||||||
|
|
||||||
writer := v2io.NewBufferedWriter(conn)
|
writer := v2io.NewBufferedWriter(conn)
|
||||||
|
defer writer.Release()
|
||||||
session.EncodeRequestHeader(request, writer)
|
session.EncodeRequestHeader(request, writer)
|
||||||
|
|
||||||
// Send first packet of payload together with request, in favor of small requests.
|
// Send first packet of payload together with request, in favor of small requests.
|
||||||
@ -131,6 +132,7 @@ func (this *VMessOutboundHandler) handleResponse(session *raw.ClientSession, con
|
|||||||
defer close(output)
|
defer close(output)
|
||||||
|
|
||||||
reader := v2io.NewBufferedReader(conn)
|
reader := v2io.NewBufferedReader(conn)
|
||||||
|
defer reader.Release()
|
||||||
|
|
||||||
header, err := session.DecodeResponseHeader(reader)
|
header, err := session.DecodeResponseHeader(reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user