mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-01-30 20:56:36 +00:00
Dokodemo TPROXY: Move "defer pw.Close()" into "responseDone()"
Fixes https://github.com/XTLS/Xray-core/issues/4194
This commit is contained in:
parent
42aea01fb5
commit
2782f13279
|
@ -180,7 +180,6 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn st
|
|||
return err
|
||||
}
|
||||
writer = NewPacketWriter(pConn, &dest, mark, back)
|
||||
defer writer.(*PacketWriter).Close()
|
||||
/*
|
||||
sockopt := &internet.SocketConfig{
|
||||
Tproxy: internet.SocketConfig_TProxy,
|
||||
|
@ -219,6 +218,10 @@ func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn st
|
|||
responseDone := func() error {
|
||||
defer timer.SetTimeout(plcy.Timeouts.UplinkOnly)
|
||||
|
||||
if pw, ok := writer.(*PacketWriter); ok {
|
||||
defer pw.Close()
|
||||
}
|
||||
|
||||
if err := buf.Copy(link.Reader, writer, buf.UpdateActivity(timer)); err != nil {
|
||||
return errors.New("failed to transport response").Base(err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue