mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-17 14:57:44 -05:00
try fix connection reuse settings
This commit is contained in:
parent
f159d504f2
commit
a67d525fc2
@ -30,7 +30,7 @@ func TestRequestSerialization(t *testing.T) {
|
|||||||
Version: 1,
|
Version: 1,
|
||||||
User: user,
|
User: user,
|
||||||
Command: protocol.RequestCommandTCP,
|
Command: protocol.RequestCommandTCP,
|
||||||
Option: protocol.RequestOption(0),
|
Option: protocol.RequestOptionConnectionReuse,
|
||||||
Address: v2net.DomainAddress("www.v2ray.com"),
|
Address: v2net.DomainAddress("www.v2ray.com"),
|
||||||
Port: v2net.Port(443),
|
Port: v2net.Port(443),
|
||||||
Security: protocol.Security(protocol.SecurityType_AES128_GCM),
|
Security: protocol.Security(protocol.SecurityType_AES128_GCM),
|
||||||
|
@ -153,6 +153,8 @@ func (v *VMessInboundHandler) HandleConnection(connection internet.Connection) {
|
|||||||
request, err := session.DecodeRequestHeader(reader)
|
request, err := session.DecodeRequestHeader(reader)
|
||||||
v.RUnlock()
|
v.RUnlock()
|
||||||
|
|
||||||
|
connection.SetReusable(request.Option.Has(protocol.RequestOptionConnectionReuse))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Cause(err) != io.EOF {
|
if errors.Cause(err) != io.EOF {
|
||||||
log.Access(connection.RemoteAddr(), "", log.AccessRejected, err)
|
log.Access(connection.RemoteAddr(), "", log.AccessRejected, err)
|
||||||
|
@ -138,9 +138,7 @@ func (v *VMessOutboundHandler) handleResponse(session *encoding.ClientSession, c
|
|||||||
}
|
}
|
||||||
go v.handleCommand(dest, header.Command)
|
go v.handleCommand(dest, header.Command)
|
||||||
|
|
||||||
if !header.Option.Has(protocol.ResponseOptionConnectionReuse) {
|
conn.SetReusable(header.Option.Has(protocol.ResponseOptionConnectionReuse))
|
||||||
conn.SetReusable(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
reader.SetCached(false)
|
reader.SetCached(false)
|
||||||
bodyReader := session.DecodeResponseBody(request, reader)
|
bodyReader := session.DecodeResponseBody(request, reader)
|
||||||
|
@ -93,14 +93,11 @@ func (v *Connection) SetWriteDeadline(t time.Time) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *Connection) SetReusable(reusable bool) {
|
func (v *Connection) SetReusable(reusable bool) {
|
||||||
if !v.config.ConnectionReuse.IsEnabled() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
v.reusable = reusable
|
v.reusable = reusable
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Connection) Reusable() bool {
|
func (v *Connection) Reusable() bool {
|
||||||
return v.reusable
|
return v.config.ConnectionReuse.IsEnabled() && v.reusable
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *Connection) SysFd() (int, error) {
|
func (v *Connection) SysFd() (int, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user