mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-30 05:56:54 -05:00
Added experiment to avoid sending the termination signal
This commit is contained in:
parent
0822160008
commit
c5357e1f00
@ -20,6 +20,7 @@ type MemoryAccount struct {
|
|||||||
Security protocol.SecurityType
|
Security protocol.SecurityType
|
||||||
|
|
||||||
AuthenticatedLengthExperiment bool
|
AuthenticatedLengthExperiment bool
|
||||||
|
NoTerminationSignal bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// AnyValidID returns an ID that is either the main ID or one of the alternative IDs if any.
|
// AnyValidID returns an ID that is either the main ID or one of the alternative IDs if any.
|
||||||
@ -47,14 +48,18 @@ func (a *Account) AsAccount() (protocol.Account, error) {
|
|||||||
return nil, newError("failed to parse ID").Base(err).AtError()
|
return nil, newError("failed to parse ID").Base(err).AtError()
|
||||||
}
|
}
|
||||||
protoID := protocol.NewID(id)
|
protoID := protocol.NewID(id)
|
||||||
var AuthenticatedLength bool
|
var AuthenticatedLength, NoTerminationSignal bool
|
||||||
if strings.Contains(a.TestsEnabled, "AuthenticatedLength") {
|
if strings.Contains(a.TestsEnabled, "AuthenticatedLength") {
|
||||||
AuthenticatedLength = true
|
AuthenticatedLength = true
|
||||||
}
|
}
|
||||||
|
if strings.Contains(a.TestsEnabled, "NoTerminationSignal") {
|
||||||
|
NoTerminationSignal = true
|
||||||
|
}
|
||||||
return &MemoryAccount{
|
return &MemoryAccount{
|
||||||
ID: protoID,
|
ID: protoID,
|
||||||
AlterIDs: protocol.NewAlterIDs(protoID, uint16(a.AlterId)),
|
AlterIDs: protocol.NewAlterIDs(protoID, uint16(a.AlterId)),
|
||||||
Security: a.SecuritySettings.GetSecurityType(),
|
Security: a.SecuritySettings.GetSecurityType(),
|
||||||
AuthenticatedLengthExperiment: AuthenticatedLength,
|
AuthenticatedLengthExperiment: AuthenticatedLength,
|
||||||
|
NoTerminationSignal: NoTerminationSignal,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,9 @@ func transferResponse(timer signal.ActivityUpdater, session *encoding.ServerSess
|
|||||||
return err
|
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 {
|
if err := bodyWriter.WriteMultiBuffer(buf.MultiBuffer{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if request.Option.Has(protocol.RequestOptionChunkStream) {
|
if request.Option.Has(protocol.RequestOptionChunkStream) && !account.NoTerminationSignal {
|
||||||
if err := bodyWriter.WriteMultiBuffer(buf.MultiBuffer{}); err != nil {
|
if err := bodyWriter.WriteMultiBuffer(buf.MultiBuffer{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user