1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-04 08:15:21 -05:00

fix usage of ray stream.

This commit is contained in:
Darien Raymond
2016-12-30 00:51:39 +01:00
parent 609dbc1f13
commit f6aa7a0053
9 changed files with 29 additions and 24 deletions

View File

@@ -109,7 +109,7 @@ func (v *Client) Dispatch(destination v2net.Destination, payload *buf.Buffer, ra
bufferedWriter.SetBuffered(false)
requestDone := signal.ExecuteAsync(func() error {
defer ray.OutboundInput().Release()
defer ray.OutboundInput().ForceClose()
if err := buf.PipeUntilEOF(ray.OutboundInput(), bodyWriter); err != nil {
return err
@@ -151,7 +151,7 @@ func (v *Client) Dispatch(destination v2net.Destination, payload *buf.Buffer, ra
}
requestDone := signal.ExecuteAsync(func() error {
defer ray.OutboundInput().Release()
defer ray.OutboundInput().ForceClose()
if err := buf.PipeUntilEOF(ray.OutboundInput(), writer); err != nil {
log.Info("Shadowsocks|Client: Failed to transport all UDP request: ", err)

View File

@@ -175,11 +175,11 @@ func (v *Server) handleConnection(conn internet.Connection) {
User: request.User,
Inbound: v.meta,
})
defer ray.InboundOutput().Release()
defer ray.InboundOutput().ForceClose()
defer ray.InboundInput().Close()
requestDone := signal.ExecuteAsync(func() error {
defer ray.InboundOutput().Release()
defer ray.InboundOutput().ForceClose()
bufferedWriter := bufio.NewWriter(conn)
defer bufferedWriter.Release()