diff --git a/transport/internet/kcp/connection.go b/transport/internet/kcp/connection.go index e6ba390d..ac7b20d0 100644 --- a/transport/internet/kcp/connection.go +++ b/transport/internet/kcp/connection.go @@ -439,10 +439,12 @@ func (this *Connection) updateTask() { } func (this *Connection) Reusable() bool { - return false + return this.Config.ConnectionReuse.IsEnabled() && this.reusable } -func (this *Connection) SetReusable(b bool) {} +func (this *Connection) SetReusable(b bool) { + this.reusable = b +} func (this *Connection) Terminate() { if this == nil { diff --git a/transport/internet/kcp/listener.go b/transport/internet/kcp/listener.go index 28b20489..b682c8a0 100644 --- a/transport/internet/kcp/listener.go +++ b/transport/internet/kcp/listener.go @@ -100,6 +100,7 @@ func NewListener(address v2net.Address, port v2net.Port, options internet.Listen return nil, err } kcpSettings := networkSettings.(*Config) + kcpSettings.ConnectionReuse = &ConnectionReuse{Enable: false} auth, err := kcpSettings.GetAuthenticator() if err != nil {