1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

release all readers and writers

This commit is contained in:
v2ray 2016-04-12 21:56:36 +02:00
parent 70f803173a
commit 42b8dbe871
2 changed files with 4 additions and 0 deletions

View File

@ -95,8 +95,10 @@ func (this *SocksServer) handleConnection(connection *hub.TCPConn) {
timedReader := v2net.NewTimeOutReader(120, connection)
reader := v2io.NewBufferedReader(timedReader)
defer reader.Release()
writer := v2io.NewBufferedWriter(connection)
defer writer.Release()
auth, auth4, err := protocol.ReadAuthentication(reader)
if err != nil && err != protocol.Socks4Downgrade {

View File

@ -90,6 +90,7 @@ func (this *VMessOutboundHandler) handleRequest(session *raw.ClientSession, conn
defer finish.Unlock()
writer := v2io.NewBufferedWriter(conn)
defer writer.Release()
session.EncodeRequestHeader(request, writer)
// 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)
reader := v2io.NewBufferedReader(conn)
defer reader.Release()
header, err := session.DecodeResponseHeader(reader)
if err != nil {