1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-05 16:55:27 -05:00

able to close ray stream with error

This commit is contained in:
Darien Raymond
2017-01-10 14:22:42 +01:00
parent 1cf9cd5d78
commit 72992c7478
15 changed files with 57 additions and 61 deletions

View File

@@ -169,12 +169,8 @@ func (v *Server) handleConnection(conn internet.Connection) {
User: request.User,
Inbound: v.meta,
})
defer ray.InboundOutput().ForceClose()
defer ray.InboundInput().Close()
requestDone := signal.ExecuteAsync(func() error {
defer ray.InboundOutput().ForceClose()
bufferedWriter := bufio.NewWriter(conn)
responseWriter, err := WriteTCPResponse(request, bufferedWriter)
if err != nil {
@@ -215,6 +211,8 @@ func (v *Server) handleConnection(conn internet.Connection) {
if err := signal.ErrorOrFinish2(requestDone, responseDone); err != nil {
log.Info("Shadowsocks|Server: Connection ends with ", err)
ray.InboundInput().CloseError()
ray.InboundOutput().CloseError()
}
}