mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-12-22 19:33:32 +02:00
Added experiment to avoid sending the termination signal
(cherry picked from commit c5357e1f000054ba5836468922cae52a830c8019)
This commit is contained in:
parent
ff35118af5
commit
7038bded7b
3 changed files with 10 additions and 3 deletions
|
@ -18,6 +18,7 @@ type MemoryAccount struct {
|
|||
Security protocol.SecurityType
|
||||
|
||||
AuthenticatedLengthExperiment bool
|
||||
NoTerminationSignal bool
|
||||
}
|
||||
|
||||
// AnyValidID returns an ID that is either the main ID or one of the alternative IDs if any.
|
||||
|
@ -45,14 +46,18 @@ func (a *Account) AsAccount() (protocol.Account, error) {
|
|||
return nil, newError("failed to parse ID").Base(err).AtError()
|
||||
}
|
||||
protoID := protocol.NewID(id)
|
||||
var AuthenticatedLength bool
|
||||
var AuthenticatedLength, NoTerminationSignal bool
|
||||
if strings.Contains(a.TestsEnabled, "AuthenticatedLength") {
|
||||
AuthenticatedLength = true
|
||||
}
|
||||
if strings.Contains(a.TestsEnabled, "NoTerminationSignal") {
|
||||
NoTerminationSignal = true
|
||||
}
|
||||
return &MemoryAccount{
|
||||
ID: protoID,
|
||||
AlterIDs: protocol.NewAlterIDs(protoID, uint16(a.AlterId)),
|
||||
Security: a.SecuritySettings.GetSecurityType(),
|
||||
AuthenticatedLengthExperiment: AuthenticatedLength,
|
||||
NoTerminationSignal: NoTerminationSignal,
|
||||
}, nil
|
||||
}
|
||||
|
|
|
@ -207,7 +207,9 @@ func transferResponse(timer signal.ActivityUpdater, session *encoding.ServerSess
|
|||
return err
|
||||
}
|
||||
|
||||
if request.Option.Has(protocol.RequestOptionChunkStream) {
|
||||
account := request.User.Account.(*vmess.MemoryAccount)
|
||||
|
||||
if request.Option.Has(protocol.RequestOptionChunkStream) && !account.NoTerminationSignal {
|
||||
if err := bodyWriter.WriteMultiBuffer(buf.MultiBuffer{}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
|||
return err
|
||||
}
|
||||
|
||||
if request.Option.Has(protocol.RequestOptionChunkStream) {
|
||||
if request.Option.Has(protocol.RequestOptionChunkStream) && !account.NoTerminationSignal {
|
||||
if err := bodyWriter2.WriteMultiBuffer(buf.MultiBuffer{}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue